Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background post #6532

Merged
merged 40 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cee3747
Merge pull request #1 from gitcoinco/master
theCydonian Mar 11, 2020
fc00c01
added status update background system
Mar 19, 2020
db00e11
Adds a system for submitting status updates with backgrounds. Works i…
Mar 19, 2020
86e2d1d
Added a system for submitting status updates with text on a colorful …
Mar 19, 2020
9358f55
Merge pull request #2 from theCydonian/colorful-updates
theCydonian Mar 19, 2020
10cf93b
Merge branch 'master' into master
theCydonian Mar 19, 2020
d73c04f
Merge branch 'master' of https://github.com/gitcoinco/web into gitcoi…
theCydonian Mar 19, 2020
c4525f2
Merge branch 'gitcoinco-master'
theCydonian Mar 19, 2020
e26e8f2
Added and fixed a system for adding status updates with colorful back…
theCydonian Mar 20, 2020
c41abde
Fixed indentation.
theCydonian Mar 20, 2020
563117d
Removed unintended files added by npm
theCydonian Mar 23, 2020
fecdbe3
Merge branch 'master' into master
theCydonian Mar 23, 2020
6640406
Merge branch 'master' into master
danlipert Mar 25, 2020
e60abbb
fixed formatting
theCydonian Mar 29, 2020
1e07068
Merge branch 'master' into master
theCydonian Mar 29, 2020
9309c51
Merge branch 'master' into master
danlipert Mar 31, 2020
75b6ad3
Merge branch 'master' into master
danlipert Mar 31, 2020
5656a0d
removed hide class
theCydonian Apr 1, 2020
5b63ae6
removed indent on closing bracket
theCydonian Apr 1, 2020
3b3d75c
simplified .children().children() to .find()
theCydonian Apr 1, 2020
f5f26ff
added close tag to bg selector
theCydonian Apr 1, 2020
0165e37
de-indented div on line 260
theCydonian Apr 1, 2020
7052c04
replaced textarea with code from master
theCydonian Apr 1, 2020
cc795b5
Merge branch 'master' into master
theCydonian Apr 1, 2020
3beaaae
Update package.json
thelostone-mc Apr 7, 2020
f1f9a2e
Merge branch 'master' into master
danlipert Apr 7, 2020
9750e48
Merge branch 'master' into master
danlipert Apr 8, 2020
9cf163c
Merge branch 'master' into master
danlipert Apr 8, 2020
1cce868
Merge branch 'master' into master
danlipert Apr 8, 2020
be6ef70
Merge branch 'master' into theCydonian/color-post
octavioamu Apr 29, 2020
8b67fcf
Merge branch 'master' into theCydonian/color-post
thelostone-mc Apr 29, 2020
20c8886
image optimization
octavioamu Apr 29, 2020
a6cb55d
remove changes on npm versions
octavioamu Apr 29, 2020
3c29efe
fixes and missing code
octavioamu Apr 29, 2020
152a610
remove unrelated code
octavioamu Apr 29, 2020
1436a64
Merge branch 'master' into theCydonian/color-post
danlipert Apr 30, 2020
9bf9763
Update activity.html
thelostone-mc Apr 30, 2020
e465009
Update activity.html
thelostone-mc Apr 30, 2020
98b7616
remove repeated code
octavioamu Apr 30, 2020
0ffda37
change icon
octavioamu Apr 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
url(r'^api/v0.1/profile/(?P<handle>.*)', dashboard.views.profile_details, name='profile_details'),
url(r'^api/v0.1/user_card/(?P<handle>.*)', dashboard.views.user_card, name='user_card'),
url(r'^api/v0.1/banners', dashboard.views.load_banners, name='load_banners'),
url(r'^api/v0.1/status_wallpapers', townsquare.views.load_wallpapers, name='load_wallpapers'),
url(
r'^api/v0.1/get_suggested_contributors',
dashboard.views.get_suggested_contributors,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/burst-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/burst-pink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/burst-yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2-v2-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2-v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2-v3-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2-v3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h4-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/status_backgrounds/h4.png
Binary file added app/assets/status_backgrounds/network-blue.png
60 changes: 59 additions & 1 deletion app/assets/v2/css/activity_stream.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,59 @@
text-align: left;
}

#bg-selector {
height: 4em;
width: 100%;
padding: 0.5em;
overflow: auto;
white-space: nowrap;
}

.bg-thumbnail {
display: inline-block;
height: 2.35em;
width: 2em;
margin-left:0.2em;
margin-right: 0.2em;
}

.bg-icon {
width:100%;
cursor: pointer;
}

.status_background {
width:100%;
}

.status_background_container {
margin-top: 1em;
position: relative;
}

.image-text-container {
padding:1.5em;
text-align: center;
width: 100%;
text-overflow: wrap;
color: white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 18pt;
font-weight: bold;
}


.selector-bar {
background-color: #3E00FF;
height: 0.15em;
width: 100%;
margin-top: 0.2em;
border-radius: 0.075em;
}

.action {
padding: 3px;
border-radius: 5px;
Expand All @@ -70,6 +123,11 @@ a .sup {
color: black;
}

.tip_activity,
.action:hover {
cursor: pointer;
}

.action.open {
background-color: #eeeeee;
}
Expand Down Expand Up @@ -157,7 +215,7 @@ a .sup {
}


.tip_activity{
.tip_activity {
color: black;
}

Expand Down
121 changes: 115 additions & 6 deletions app/assets/v2/js/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,65 @@ const youtube_re = /(?:https?:\/\/|\/\/)?(?:www\.|m\.)?(?:youtu\.be\/|youtube\.c
const giphy_re = /(?:https?:\/\/)?(?:media0\.)?(?:giphy\.com\/media\/)/;

$(document).ready(function() {

var embedded_resource = '';
const GIPHY_API_KEY = document.contxt.giphy_key;

let button = document.querySelector('#btn_post');

// populates background selector on load
let bgs = [
'cannon-green-blue',
'h2-v2',
'burst-yellow',
'burst-pink',
'burst-blue',
'eletric_design',
'dvdptr-blue-green',
'cannon-yellow-pink',
'network-yellow',
'h4',
'network-blue',
'network-pink',
'h2',
'cannon-blue-yellow',
'dvdptr-blue-yellow'
];

let selector = $('#bg-selector');

for (var i = 0; i < bgs.length; i++) {
selector.append('<div data-bg-name="' + bgs[i] + '" class="bg-thumbnail"><img class="bg-icon" draggable="false" src="/static/status_backgrounds/' + bgs[i] + '-icon.png"/><div class="selector-bar hide"></div></div>');
}

function closeBackgroundDropdown(e) {
e.preventDefault();
$('#bg-selector').attr('data-selected', null);
$('#bg-selector').addClass('hide');
embedded_resource = '';
$('#bg-selector').children('div').children('div').addClass('hide');
}

function selectGif(e) {
embedded_resource = $(e.target).data('src');
$('#preview-img').attr('src', embedded_resource);
$('#preview').show();
$('#thumbnail').hide();
}

function deselectGif(e) {
embedded_resource = '';
$('#preview-img').attr('src', '');
$('#preview').hide();
$('#thumbnail').hide();
$('#btn_gif').removeClass('selected');
$('.gif-inject-target').removeClass('show');
}

function deselectVideo(e) {
$('#video-button').removeClass('selected');
$('#video_container').remove();
}

function injectGiphy(query) {
const endpoint = 'https://api.giphy.com/v1/gifs/search?limit=13&api_key=' + GIPHY_API_KEY + '&offset=0&rating=G&lang=en&q=' + query;
Expand Down Expand Up @@ -155,7 +202,9 @@ $(document).ready(function() {
} else {
$('#thumbnail-desc').text('');
if (no_lb) {
embedded_resource = '';
if (embedded_resource != $('#bg-selector').attr('data-selected')) {
embedded_resource = '';
}
$('#thumbnail').hide();
}
}
Expand Down Expand Up @@ -218,10 +267,57 @@ $(document).ready(function() {
$('#textarea').focus();
}

$('#btn_gif').click(function(e) {
e.preventDefault();
closeBackgroundDropdown(e);
deselectVideo(e);

$('#poll-button').removeClass('selected');
$('#poll_container').remove();
});

var selectedElement = null;
// handle background selection

$('.bg-thumbnail').click(function(e) {
e.preventDefault();

$('#bg-selector').find('.selector-bar').addClass('d-none');
$(this).children('div').removeClass('d-none');

selectedElement = $(this);
$('#bg-selector').attr('data-selected', $(this).attr('data-bg-name'));
embedded_resource = $(this).attr('data-bg-name');
});

// handle add background button push
$('body').on('click', '#background-button', function(e) {
e.preventDefault();
$('#bg-selector').toggleClass('d-none');
if ($('#bg-selector').hasClass('d-none')) {
closeBackgroundDropdown(e);
}

$('#poll-button').removeClass('selected');
$('#poll_container').remove();
deselectVideo(e);
deselectGif(e);
});

// handle poll button

document.is_shift = false;
// handle shift button
$('body').on('keyup', '#textarea', function(e) {
if (e.keyCode == 16) {
document.is_shift = false;
}
});
// handle shift button
$('body').on('click', '#poll-button', function(e) {
e.preventDefault();
deselectGif(e);
closeBackgroundDropdown(e);
deselectVideo(e);
$(this).toggleClass('selected');
var is_selected = $(this).hasClass('selected');

Expand All @@ -246,6 +342,11 @@ $(document).ready(function() {
// handle video button
$('body').on('click', '#video-button', function(e) {
e.preventDefault();
closeBackgroundDropdown(e);
deselectGif(e);
$('#poll-button').removeClass('selected');
$('#poll_container').remove();

$(this).toggleClass('selected');
var is_selected = $(this).hasClass('selected');

Expand All @@ -254,10 +355,10 @@ $(document).ready(function() {
const item = $(this).data('gfx') ? $(this).data('gfx') : items[Math.floor(Math.random() * items.length)];

let html = `
<div data-gfx=` + item + ` id=video_container class="bg-lightblue p-2">
<div data-gfx=` + item + ` id=video_container class="bg-lightblue p-2">
<img src='/static/v2/images/` + item + `'>
</div>
`;
</div>
`;

$(html).insertAfter('#status');
} else {
Expand Down Expand Up @@ -313,6 +414,7 @@ $(document).ready(function() {
if ($('#btn_post').is(':disabled')) {
return;
}

const data = new FormData();
const message = $('#textarea');
const the_message = message.val().trim();
Expand Down Expand Up @@ -340,6 +442,7 @@ $(document).ready(function() {
const description = $('#thumbnail-desc').text();
const image = $('#thumbnail-img').attr('src');
const youtube = embedded_resource.match(youtube_re);
const background = $('#bg-selector').attr('data-selected');

if (embedded_resource.match(giphy_re)) {
data.append('resource', 'gif');
Expand All @@ -352,6 +455,10 @@ $(document).ready(function() {
data.append('title', title);
data.append('description', description);
data.append('image', image);
} else if (background != null) {
data.append('resource', 'background');
data.append('resourceProvider', 'gitcoin');
data.append('resourceId', background);
} else {
data.append('resource', 'content');
data.append('resourceProvider', link);
Expand All @@ -361,7 +468,9 @@ $(document).ready(function() {
data.append('image', image);
}
}

$('#bg-selector').attr('data-selected', null);
$('#bg-selector').addClass('d-none');
$('#bg-selector').children('div').children('div').addClass('d-none');
var fail_callback = function() {
message.val(the_message);
localStorage.setItem(lskey, the_message);
Expand Down
5 changes: 4 additions & 1 deletion app/dashboard/templates/profiles/status_box.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
id="textarea"
class="form__input p-2 font-body status-textarea"
placeholder="{% if placeholder %}{{placeholder}}{%else%}What are you thinking?{%endif%}"
style="resize: none; height: 7em;"
data-maxlen={% if max_length %}{{max_length}}{%else%}280{%endif%}
style="height: 70px;"
></textarea>
<input type="hidden" name="what" value="{{what}}:{{whatid}}">
<div id="textarea-dropdown" class="dropdown-menu" style="top: initial; left: initial;"></div>
<div class="status-menu position-absolute d-flex flex-wrap" style="width: 3.6em; right: 0; top: 0px;">
<button id="emoji-button" class="btn btn-sm p-1" data-toggle="tooltip" title="Add an emoji to post." style="bottom: 3.5em; right: 0;"><i class="far fa-fw fa-smile"></i></button>
<button id="background-button" style="bottom: 3.5em; right: 0em; flex:1;" class="btn btn-sm p-1"><i class="fas fa-image" data-toggle="tooltip" title="" data-original-title="Add a background to post"></i></button>
{% if is_alpha_tester %}
<button id="video-button" class="btn btn-sm p-1" data-toggle="tooltip" title="Add a video call to post." style="bottom: 3.5em; right: 1.5em;"><i class="fas fa-fw fa-video"></i></i></button>
{% endif %}
Expand All @@ -33,6 +34,8 @@
</div>
<button id="poll-button" class="btn btn-sm p-1" data-toggle="tooltip" title="Add a poll to post." style="bottom: 2em; right: 0em;"><i class="fas fa-fw fa-chart-bar"></i></i></button>
</div>
<div class="d-none" id="bg-selector">
</div>
</div>
<div class="btn-group-toggle text-center text-md-left activity_type_selector" {% if not suppress_data_toggle %} data-toggle="buttons" {%endif%}>
{% if tags %}
Expand Down
Loading