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

Add admin pages to the mobile version #7295

Closed
wants to merge 7 commits into from

Conversation

SansPseudoFix
Copy link
Contributor

@SansPseudoFix SansPseudoFix commented Jan 25, 2017

I was starting to code the report view, but I figured out I have to code all admin pages, so…
This is a early-PR because I don't want to code every pages and finally understand it won't be merge or wanted.

So far, reports page, user-search and user entry pages are mobile friendly (doesn't mean totally finished though). I also add admin menu to the drawer.

Here some screenshots:

drawer
report
usersearch

What do you think? Do I continue or not?

Next:

  • dashboard
  • weekly user stats
  • pod stats
  • pod network?
  • sidekiq monitor? already mobile friendly
  • refactoring/pronto

Edit: and, of course, I forgot my "damit, I forgot pronto" commit… Sorry.

@@ -0,0 +1,70 @@

%li.user.media
%div.pull-left

Choose a reason for hiding this comment

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

%div.pull-left can be written as .pull-left since %div is implicit

%span.media-object
= person_image_tag(user.person, size: :thumb_small)

%div.media-body.row

Choose a reason for hiding this comment

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

%div.media-body.row can be written as .media-body.row since %div is implicit

= person_image_tag(user.person, size: :thumb_small)

%div.media-body.row
%div.pull-right

Choose a reason for hiding this comment

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

%div.pull-right can be written as .pull-right since %div is implicit

%div.media-body.row
%div.pull-right
%span.label.label-default
= t('.id')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

= t('.id')
= user.id
%span.label.label-info
= t('.guid')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


%div
.unstyled.text-right.actions
= link_to t('admins.user_search.view_profile'), person_path(user.person), class: 'btn btn-default btn-block'

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%div
.unstyled.text-right.actions
= link_to t('admins.user_search.view_profile'), person_path(user.person), class: 'btn btn-default btn-block'
= link_to t('admins.user_search.add_invites'), add_invites_path(user.invitation_code), class: 'btn btn-info btn-block'

Choose a reason for hiding this comment

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

  • Line is too long. [126/120]
  • Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

= link_to t('admins.user_search.view_profile'), person_path(user.person), class: 'btn btn-default btn-block'
= link_to t('admins.user_search.add_invites'), add_invites_path(user.invitation_code), class: 'btn btn-info btn-block'
- unless user.person.closed_account
= link_to t('admins.user_search.close_account'), admin_close_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure') }, class: 'btn btn-danger btn-block'

Choose a reason for hiding this comment

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

  • Line is too long. [196/120]
  • Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
  • Space inside { detected.
  • Space inside } detected.

= link_to t('admins.user_search.close_account'), admin_close_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure') }, class: 'btn btn-danger btn-block'

- unless user.closed_account?
- unless user.access_locked?

Choose a reason for hiding this comment

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

Do not use unless with else. Rewrite these with the positive case first.


- unless user.closed_account?
- unless user.access_locked?
= link_to t('admins.user_search.lock_account'), admin_lock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_lock_account') }, class: 'btn btn-danger btn-block'

Choose a reason for hiding this comment

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

  • Line is too long. [209/120]
  • Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
  • Space inside { detected.
  • Space inside } detected.

- unless user.access_locked?
= link_to t('admins.user_search.lock_account'), admin_lock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_lock_account') }, class: 'btn btn-danger btn-block'
- else
= link_to t('admins.user_search.unlock_account'), admin_unlock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_unlock_account') }, class: 'btn btn-danger btn-block'

Choose a reason for hiding this comment

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

  • Line is too long. [215/120]
  • Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
  • Space inside { detected.
  • Space inside } detected.

- else
= link_to t('admins.user_search.unlock_account'), admin_unlock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_unlock_account') }, class: 'btn btn-danger btn-block'

%div.row

Choose a reason for hiding this comment

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

%div.row can be written as .row since %div is implicit

= link_to t('admins.user_search.unlock_account'), admin_unlock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_unlock_account') }, class: 'btn btn-danger btn-block'

%div.row
%div.col-md-5

Choose a reason for hiding this comment

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

%div.col-md-5 can be written as .col-md-5 since %div is implicit

%div.row
%div.col-md-5
%dl.dl-horizontal
%dt= t('username')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dl.dl-horizontal
%dt= t('username')
%dd= user.username
%dt= t('.email')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dd= user.username
%dt= t('.email')
%dd= user.email
%dt= t('.diaspora_handle')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dd= user.email
%dt= t('.diaspora_handle')
%dd= user.person.diaspora_handle
%dt= t('.last_seen')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dt= t('.diaspora_handle')
%dd= user.person.diaspora_handle
%dt= t('.last_seen')
%dd= user.last_seen || t('.unknown')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dd= user.person.diaspora_handle
%dt= t('.last_seen')
%dd= user.last_seen || t('.unknown')
-if user.invited_by.present?

Choose a reason for hiding this comment

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

The - symbol should have one space separating it from code

%dt= t('.last_seen')
%dd= user.last_seen || t('.unknown')
-if user.invited_by.present?
%dt= t('.invite_token')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

-if user.invited_by.present?
%dt= t('.invite_token')
%dd= invite_code_url(user.invited_by.invitation_code)
%dt= t('.account_closed')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dt= t('.account_closed')
%dd
- if user.person.closed_account
%span.label.label-warning= t('.yes')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

- if user.person.closed_account
%span.label.label-warning= t('.yes')
- else
%span.label.label-success= t('.no')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%span.label.label-warning= t('.yes')
- else
%span.label.label-success= t('.no')
%dt= t('.nsfw')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dt= t('.nsfw')
%dd
- if user.person.profile.nsfw
%span.label.label-warning= t('.yes')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

- if user.person.profile.nsfw
%span.label.label-warning= t('.yes')
- else
%span.label.label-success= t('.no')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

- else
%span.label.label-success= t('.no')

%h4= t('layouts.header.profile')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%h4= t('layouts.header.profile')

%dl.dl-horizontal
%dt= t('people.profile_sidebar.born')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dl.dl-horizontal
%dt= t('people.profile_sidebar.born')
%dd= user.person.profile.birthday
%dt= t('people.profile_sidebar.gender')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

%dd= user.person.profile.birthday
%dt= t('people.profile_sidebar.gender')
%dd= user.person.profile.gender
%dt= t('people.profile_sidebar.location')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@cmrd-senya
Copy link
Member

#7295 (comment) this one is still not fixed

Copy link
Member

@cmrd-senya cmrd-senya left a comment

Choose a reason for hiding this comment

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

Here are a few notes after a quick scan. I'll do a full review round after you respond to them.

| Alice Smith | alice@alice.alice |

And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
Given an admin with email "alice@alice.alice"
Copy link
Member

Choose a reason for hiding this comment

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

I think we should make alice an admin just for the navigate to the admin pages scenario. All other sections should run with alice as a normal user.

@@ -15,6 +15,10 @@ def create_user(overrides={})
user
end

def make_admin(user)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we really need to wrap Role.add_admin(user) method in another one here


= t(".amount_of", count: counter)
%br
- @created_users_by_week[selected_week].each do |m|
Copy link
Member

Choose a reason for hiding this comment

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

should be created_users_by_week instead of @created_users_by_week

Copy link
Member

Choose a reason for hiding this comment

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

Doing that I can an error no implicit conversion of String into Integer, not sure how to solve it, I tried to print selected_week but it looks it is empty. Weird.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks got it. I did it with only one variable. So, corrected.

@Flaburgan
Copy link
Member

So still a question, all other points should be resolved.

.pull-right .label{ display: inline-block; }
}
}

.invite-emails {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should go below the /** Invites panel **/ comment

Copy link
Member

@cmrd-senya cmrd-senya left a comment

Choose a reason for hiding this comment

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

Okay, I reviewed the PR once again. Everything generally looks good to me. There are a few more comments, which are mostly nit-picking. IMO it would be nice to fix them. I can approve the PR just after this is sorted out.

:ruby
model = instance_variable_get("@#{name}")
count = model[:yesterday]
name = name == :aspect_memberships ? t(".shares", count: count) : t(".#{name}", count: count)
Copy link
Member

Choose a reason for hiding this comment

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

Could you please pick a different name for the variable on the left side insead of name? Reusing the same name looks confusing. Also this new variable has a different meaning, it's rather a label with count. Maybe it should be called label_with_count or heading_counter or count_label, or something like this?


.col-md-3
%h2{style: "font-weight:bold;"}
= name.to_s
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to_s here, it is already a string

= name.to_s
%h4
= model[:day_before]
%span.percent_change{class: (model[:change] > 0 ? "green" : "red")}
Copy link
Member

Choose a reason for hiding this comment

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

Actually these "green" and "red" classes don't exist, so I think we should either remove them or implement

%dd= user.email
%dt= t('.diaspora_handle')
%dt= t(".diaspora_handle")
Copy link
Member

Choose a reason for hiding this comment

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

We were moving away from calling this a "diaspora handle" to a name "diaspora id". It's not necessary to change the translation ID here, but maybe we may want to change the English translation actually? @SuperTux88 what do you think?

I'm talking about this label:
2017-06-26 18-49-16

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the key shouldn't be changed (otherwise we need to re-translate it), but the translation should be "diaspora* ID".

@Flaburgan
Copy link
Member

Remarks fixed, thanks for your review!

Copy link
Member

@cmrd-senya cmrd-senya left a comment

Choose a reason for hiding this comment

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

Okay, looks good to me now. I don't know if anyone else will review, but note that before merge some of the commits should be squashed.

@SuperTux88
Copy link
Member

I just had a look at this (because I wanted to check if I can merge it to 0.6.7.0), and I think the code is OK and it works. There are probably things that can be done better (for example I'd like when the admin section stays open in the drawer when at an admin page, so I don't need to open it every time), but this can always be improved in a follow up. So it's OK for now (this PR is already big enough), and I don't want to polish mobile admin that much anyway, because I think we should focus on making the desktop view more responsive.

But there are really many commits, so as @cmrd-senya wrote, it would be good if you can squash some of them (so fix pronto stuff and review remarks in the commit where it belongs). So can you try to squash some of them, because when trying to find where some lines come from and why they are the way they are and then find something like "Fix remarks" with some random changes in it doesn't help ;) When it's too complicated and you have many conflicts, then just let it as it is, instead of breaking everything when resolving conflicts.

@Flaburgan
Copy link
Member

I was waiting for a final "Everything is fine" to squash ;) I'll do it today.

@Flaburgan Flaburgan force-pushed the report-mobile branch 2 times, most recently from da20b2e to 2e9a812 Compare July 4, 2017 08:26
…responsive code to use bootstrap grid

Hide pod version alert only in the mobile version, not depending on screen size
@Flaburgan
Copy link
Member

Alright, commits squashed from 28 down to 7. Please tell me if that's enough.

@Flaburgan
Copy link
Member

Flaburgan commented Jul 4, 2017

I just realized that this PR doesn't deal with the moderator role. I guess it's not a blocker I'll do it in another one. There is no bug, the drawer doesn't display anything.

@SuperTux88 SuperTux88 added this to the 0.6.7.0 milestone Jul 4, 2017
Copy link
Member

@SuperTux88 SuperTux88 left a comment

Choose a reason for hiding this comment

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

Alright, commits squashed from 28 down to 7. Please tell me if that's enough.

Yes 👍

@SuperTux88 SuperTux88 closed this in 07d0ed9 Jul 5, 2017
@SuperTux88
Copy link
Member

Merged as 07d0ed9, 427aa87, 2782edc, a7d97b7, 7bdf33e, 5cb4c6e and 276b640

Thank you @SansPseudoFix and @Flaburgan and also thank you @cmrd-senya for the reviews ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants