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

grant/cancel-contribute revamp #2946

Merged
merged 4 commits into from
Nov 26, 2018
Merged

Conversation

thelostone-mc
Copy link
Member

Description

untitled

@thelostone-mc thelostone-mc added frontend This needs frontend expertise. Gitcoin Grants Gitcoin Grants labels Nov 26, 2018
@thelostone-mc thelostone-mc self-assigned this Nov 26, 2018
@@ -35,87 +36,100 @@
</div>
</div>
</div>
<img src="{% static "v2/images/bitmap.png" %}" width="100%" />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth DRYing this up a bit?

DRY = dont repeat yourself

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I should do that 🙌

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owocki is there a specific place you see the need for DRY or just the file in general?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captnseagraves I believe this was what @owocki was talking about
904a865

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owocki is there a specific place you see the need for DRY or just the file in general?

the copy/pasted 'warning: were in alpha' warning


<div class="col-12 grant-banner py-5 row mx-0">
<div class="col-12 offset-md-2 col-md-3 py-4 banner-img">
<img src="{% if grant.logo and grant.logo.url %}{{ grant.logo.url }}{% else %}{% with grant_logo='v2/images/grants/logos/' id=grant.id|modulo:3|add:1 %} {% static grant_logo|addstr:id|add:'.png' %} {% endwith %} {% endif %}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id=grant.id|modulo:3|add:1

static grant_logo|addstr:id|add:'.png'

this logic seems unnecessarily complicated to put into the template. what is it doing? why can't we create a parameter off of the grant obj?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So since we weren't saving an image if the grant owner doesn't add it! We've map it to one of the 4 static assets (default images) we have.
to ensure the same default always loads -> I just go grant_id % 3 + 1 to map it to the file

I know it's meh 😓 could use some help with that.

but ideally that code shows this

screen shot 2018-11-26 at 11 00 23 pm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i really like the design. but still think the logic for what image is shown could be encapsulated into a method off of the grants object.

@owocki
Copy link
Contributor

owocki commented Nov 26, 2018

left a few comments. screenshot looks good 👌

Copy link
Contributor

@captnseagraves captnseagraves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Just want to hear back from @owocki on his comment.

@@ -35,87 +36,100 @@
</div>
</div>
</div>
<img src="{% static "v2/images/bitmap.png" %}" width="100%" />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owocki is there a specific place you see the need for DRY or just the file in general?

@@ -14,12 +14,13 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load static humanize i18n %}
{% load static humanize i18n grants_extra %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is grants_extra doing? I haven't seen this yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captnseagraves #2946 (comment)
I would appreciate some help making this nicer 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grants_extra has modulo helper function #2946 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thelostone-mc could we put this logic in the grants/views.py grant_new function at ln160? Pseudocode: if logo == None perform logic at ln65 of grants/cancel. This address this issue on object creation and puts the logic in a better place than the template.

@codecov
Copy link

codecov bot commented Nov 26, 2018

Codecov Report

Merging #2946 into grants will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           grants    #2946   +/-   ##
=======================================
  Coverage   17.05%   17.05%           
=======================================
  Files         175      175           
  Lines       13864    13864           
  Branches     1813     1813           
=======================================
  Hits         2365     2365           
  Misses      11491    11491           
  Partials        8        8

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c85b75...834f395. Read the comment docs.

@thelostone-mc
Copy link
Member Author

thelostone-mc commented Nov 26, 2018

@captnseagraves @owocki

{% with grant_logo='v2/images/grants/logos/' id=grant.id|modulo:3 %} {% static grant_logo|addstr:id|add:'.png' %} {% endwith %} {% endif %} -> evaluates to
v2/images/grants/logos/0.png ( / 1.png / 2.png / 3.png)

I basically needed a modulo 3 of the grant id to decide which static asset to map to it to and ensure that it stays the same 😅

@thelostone-mc thelostone-mc merged commit b41fd07 into gitcoinco:grants Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend This needs frontend expertise. Gitcoin Grants Gitcoin Grants
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants