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

Feat/edit twitter #7384

Merged
merged 4 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/assets/v2/css/grants/detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ textarea.editable {

#form--input__description,
#form--input__reference-url,
#form--twitter__account,
#form--input__title,
#contract_owner_address {
width: 100%;
Expand Down
4 changes: 4 additions & 0 deletions app/assets/v2/js/grants/detail.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const editableFields = [
'#form--input__title',
'#form--twitter__account',
'#form--input__reference-url',
'#contract_owner_address',
'#grant-members',
Expand Down Expand Up @@ -111,6 +112,7 @@ $(document).ready(function() {
$('.select2-selection__rendered').removeAttr('title');
$('#form--input__title').height($('#form--input__title').prop('scrollHeight'));
$('#form--input__reference-url').height($('#form--input__reference-url').prop('scrollHeight'));
$('#form--twitter__account').height($('#form--twitter__account').prop('scrollHeight'));

$('#edit-details').on('click', (event) => {
event.preventDefault();
Expand Down Expand Up @@ -146,12 +148,14 @@ $(document).ready(function() {

let edit_title = $('#form--input__title').val();
let edit_reference_url = $('#form--input__reference-url').val();
let twitter_account = $('#form--twitter__account').val();
let edit_grant_members = $('#grant-members').val();
let edit_categories = $('#grant-categories').val();

let data = {
'edit-title': edit_title,
'edit-reference_url': edit_reference_url,
'edit-twitter_account': twitter_account,
'edit-grant_members[]': edit_grant_members,
'edit-categories[]': edit_categories
};
Expand Down
2 changes: 0 additions & 2 deletions app/assets/v2/js/grants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,4 @@ $(document).on('click', '.following-action', async(e) => {
element.closest('.grant-card').hide();
}
}

console.log(response);
});
17 changes: 8 additions & 9 deletions app/grants/templates/grants/detail/funding.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
{% if not grant.twitter_verified %}
<div class="my-0 mx-0">
<div class="verification__warning pt-0 pb-0 pr-2 pl-2 d-flex">
<i class="fas fa-exclamation-triangle verification__warning__icon mr-2"></i>
<div>
<div class="uppercase">
Warning: This grant has not verified their ownership of the twitter account listed.
</div>
<div class="font-body">
<i class="fas fa-exclamation-triangle verification__warning__icon mr-2 my-2"></i>
{% if is_team_member %}
<div class="text-right mt-3">
<button class="btn btn-sm btn-gc-blue" data-toggle="modal" data-target="#startVerification">Verify your grant</button>
<br>
or <a href="https://github.com/gitcoinco/web/issues/new/">Submit a support request</a>.
<div class="mb-3 d-inline-block font-weight-semibold">
<button class="font-caption btn btn-sm btn-gc-blue" data-toggle="modal" data-target="#startVerification">VERIFY GRANT</button>
OR <a class="font-caption" href="https://github.com/gitcoinco/web/issues/new/">SUBMIT SUPPORT REQUEST</a>.
</div>
{% endif %}
<div class="uppercase font-weight-semibold">
Warning: This grant has not verified their ownership of the twitter account listed.
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions app/grants/templates/grants/detail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ <h5 class="font-weight-bold mb-3">Verify Grant Ownership with Twitter</h5>
<script src="{% static "v2/js/lib/jquery-unveil.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
$("img").unveil();

$('#twitterVerification').on('click', async () => {
$('#twitterVerification').on('click', async () => {
const response = await fetchData('/grants/v1/api/{{grant.id}}/verify');

if (!response.ok) {
Expand Down
44 changes: 27 additions & 17 deletions app/grants/templates/grants/detail/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h6 class="modal-title text-center" id="changeLogoLabel">Change Grant Logo</h6>
<div class="col-12 col-lg-7">
<h1 class="font-title-xl my-4 font-weight-bold">
{% if is_team_member %}
<textarea id="form--input__title" class="p-0 m-0 inline-edit font-body" maxlength="150" disabled>{{ grant.title }}</textarea>
<textarea id="form--input__title" class="p-2 m-0 inline-edit font-body" maxlength="150" disabled>{{ grant.title }}</textarea>
{% else %}
{{ grant.title }}
{% endif %}
Expand All @@ -85,7 +85,10 @@ <h1 class="font-title-xl my-4 font-weight-bold">

<div class="font-body mb-2">
{% if is_team_member %}
<textarea id="form--input__reference-url" class="p-0 m-0 inline-edit" disabled>{{ grant.reference_url }}</textarea>
<div class="d-flex my-3">
<i style="width: 14px;" class="fa fa-link mr-2 text-center my-auto"></i>
<textarea id="form--input__reference-url" class="p-2 m-0 inline-edit" disabled>{{ grant.reference_url }}</textarea>
</div>
{% else %}
<i style="width: 14px;" class="fa fa-link mr-2 text-center"></i>
<a href="{{ grant.reference_url }}" target="_blank" data-toggle="tooltip" data-html="true" data-placement="top" title="Project URL">
Expand All @@ -94,22 +97,29 @@ <h1 class="font-title-xl my-4 font-weight-bold">
{% endif %}
</div>
{% if grant.twitter_handle_1 %}
<div class="font-body mb-2">
<i style="width: 14px;" class="fab fa-twitter-square mr-2 text-center"></i>
<p class="d-inline-block mb-0">
<a href="https://twitter.com/{{grant.twitter_handle_1}}" target="new" rel="nofollow" data-toggle="tooltip" data-html="true" data-placement="top" title="Project Twitter Account">{{grant.twitter_handle_1}}</a>
<button class="py-0 position-relative px-0 btn btn-sm animate-verify {% if not grant.twitter_verified %}d-none{% endif %}" data-container="body" data-toggle="popover" data-html="true" data-placement="bottom" data-trigger="hover click" data-content='
<p class="h6 my-2 text-left">
Verified Ownership
<img width="18" src="{% static "v2/images/badge-verify.svg" %}">
{% if is_team_member %}
<div class="d-flex my-3">
<i style="width: 14px;" class="fab fa-twitter-square mr-2 text-center my-auto"></i>
<textarea id="form--twitter__account" placeholder="Twitter account" class="p-2 m-0 inline-edit font-body" maxlength="150" disabled>{{ grant.twitter_handle_1 }}</textarea>
</div>
{% else %}
<div class="font-body mb-2">
<i style="width: 14px;" class="fab fa-twitter-square mr-2 text-center"></i>
<p class="d-inline-block mb-0">
<a href="https://twitter.com/{{grant.twitter_handle_1}}" target="new" rel="nofollow" data-toggle="tooltip" data-html="true" data-placement="top" title="Project Twitter Account">{{grant.twitter_handle_1}}</a>
<button class="py-0 position-relative px-0 btn btn-sm animate-verify {% if not grant.twitter_verified %}d-none{% endif %}" data-container="body" data-toggle="popover" data-html="true" data-placement="bottom" data-trigger="hover click" data-content='
<p class="h6 my-2 text-left">
Verified Ownership
<img width="18" src="{% static "v2/images/badge-verify.svg" %}">
</p>
<p>Grant owner has verified ownership of their twitter account.</p>
<a href="#">Learn more.</p>'
>
<img width="13" src="{% static 'v2/images/badge-verify.svg' %}" alt="" style="top: -2px">
</button>
</p>
<p>Grant owner has verified ownership of their twitter account.</p>
<a href="#">Learn more.</p>'
>
<img width="13" src="{% static 'v2/images/badge-verify.svg' %}" alt="" style="top: -2px">
</button>
</p>
</div>
</div>
{% endif %}
{% endif %}

{% if grant.github_project_url %}
Expand Down
6 changes: 6 additions & 0 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,12 @@ def grant_details(request, grant_id, grant_slug):
team_members.append(str(grant.admin_profile.id))
grant.team_members.set(team_members)

if 'edit-twitter_account' in request.POST and request.POST.get('edit-twitter_account') != grant.twitter_handle_1:
grant.twitter_verified = False
grant.twitter_verified_at = None
grant.twitter_verified_by = None
grant.twitter_handle_1 = request.POST.get('edit-twitter_account')

if 'edit-description' in request.POST:
grant.description = request.POST.get('edit-description')
grant.description_rich = request.POST.get('edit-description_rich')
Expand Down