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

Split admin settings #2650

Merged
merged 6 commits into from
Jun 1, 2018
Merged

Split admin settings #2650

merged 6 commits into from
Jun 1, 2018

Conversation

aamarill
Copy link

@aamarill aamarill commented May 24, 2018

@bertocq @decabeza this is a fix for issue #2586 😄

Objectives

Break up the "settings" menu into different tabs for better visualization.

Visual Changes

Screenshots

Before/was:

admin setings view before any changes

After/is:

screen shot 2018-05-23 at 4 53 07 pm

After/is (Cont.)

screen shot 2018-05-23 at 4 53 50 pm

After/is (Cont.)

screen shot 2018-05-23 at 4 53 39 pm

Notes

This change was implemented using the views structure from the "Admin/Polls/Poll Questions" menu.

Copy link
Member

@voodoorai2000 voodoorai2000 left a comment

Choose a reason for hiding this comment

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

Marvellous! 👏

</tbody>
</table>
<% else %>
<h3>No banner images to show.</h3>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change hardcoded text creating a new i18n key <%= t("admin.settings.index.no_banners_images") %> 🙏

</tbody>
</table>
<% else %>
<h3>No banner styles to show.</h3>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change hardcoded text creating a new i18n key <%= t("admin.settings.index.no_banners_styles") %>

@@ -0,0 +1,28 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove extra line 🙏

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh and don't forget to remove this extra line on a new commit, @aamarill

Copy link
Author

Choose a reason for hiding this comment

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

done!

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

Hey @aamarill, thanks for this! Just two small things:

  • Could you please rebase your branch with master so we can get @raul-fuentes' commits out of this PR?

  • Could you also squash the last 2 commits into one? Since they're basically the same

Thanks once again! ☺️

@aamarill
Copy link
Author

@aitbw No problem!

Can you please clarify your bullet points. What branch exactly (repo and branch) are you referring to when you say "your branch"? I pulled the latest from "consul/consul master branch" before I did my second commit. Is that not a standard practice?

Also, how do I squash two commits together?

Thanks! 😄

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

Sure 😌

  • When I say your branch, I'm referring to the one called 2586-split_admin_settings, which is located on your CONSUL fork

I would't know if pulling from master directly into your branch (and creating a merge commit with it) is a standard practice but I tend to avoid it since it includes commits which are not related to your proposed changes, hence making the PR harder to review

If I need to update my branch with the latest master revision, I usually do the following:

  • git checkout master
  • git pull origin master
  • git checkout your-branch
  • git rebase origin/master

You can also simplify this by doing (while being on your branch with your proposed changes) the following: git pull origin master --rebase, then do git push --force and you're all set 😸

  • To squash two commits together, do the following:

git rebase -i HEAD~2

You'll be greeted with something like this:

screenshot_2018-05-24_11-33-38

Keep the first line as it is and replace pick on the second line with either squash or fixup, the latter is even better since you'll be omitting the commit message of the latest commit on your branch (which is exactly the same as the previous commit)

@aamarill
Copy link
Author

@aitbw Thank you so much for the help so far!

I am running into trouble because I rebased my local master and fork master with consul/master... How can I get the master branch that I initially started with? Thanks!

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

@aamarill That would mean a hard reset and resetting the master branch is a no go. Are you sure you want to do that?

Also, which issues are you currently dealing with?

@aamarill
Copy link
Author

Could you please rebase your branch with master so we can get @raul-fuentes' commits out of this PR?

@aitbw The issue is that I don't have a branch that doesn't include the commits you want me to remove . (I am not referring to any code failures/issues) 😕

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

@aamarill When I asked you to rebase your branch to get @raul-fuentes' commits out of this PR, I meant the Commits and Files changed tabs here on GitHub

Of course said commits will be on your branch, they just won't show up as changes for your Pull Request

@aamarill
Copy link
Author

@aitbw Ah! I do apologize for all of the confusion, I am quite new to the git/GitHub workflow. I don't see an option to remove the commits and files from @raul-fuentes ... I am not sure if I don't have the privileges or am I not looking in the right place? Thanks!! 😄

Here's what I see on my end:

screen shot 2018-05-24 at 9 42 36 am

screen shot 2018-05-24 at 9 43 07 am

Hope that helps!

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

@aamarill Don't worry about it, we all start somewhere ☺️

If you ran on your branch git pull origin master --rebase and everything went smoothly, you need to do git push origin your-branch-name --force so the remote (as well as the PR) can be updated ☺️

@aamarill
Copy link
Author

@aitbw Thank you for your patience 🙏

Ok, I did have to do some conflict resolution, but I was able to rebase and then push back to my fork and hence update the PR. Let me know if it looks good!

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

@aamarill Don't even mention it ☺️

And yes, it looks awesome!! Now only your changes are reflected on the PR making it easier to review 🎉

Let's wait for Travis now 😸

@aamarill
Copy link
Author

This following test is failing because I added:

<h3><%= t("admin.settings.index.no_banners_styles") %></h3>
and
<h3><%= t("admin.settings.index.no_banners_images") %></h3>
to their respective partials. Any ideas?

test that is failing:

require 'i18n/tasks'

RSpec.describe 'I18n' do
  let(:i18n) { I18n::Tasks::BaseTask.new }
  let(:missing_keys) { i18n.missing_keys }
  let(:unused_keys) { i18n.unused_keys }

  it 'does not have missing keys' do
    expect(missing_keys).to be_empty,
      "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
  end

  ...
end

failure

 1) I18n does not have missing keys
     Failure/Error:
       expect(missing_keys).to be_empty,
         "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
     
       Missing 2 i18n keys, run `i18n-tasks missing' to show them
     # ./spec/i18n_spec.rb:10:in `block (2 levels) in <top (required)>'

Output of $: i18n-tasks missing

~/Bloc/Module_6/consul $ i18n-tasks missing
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.6-compliant syntax, but you are running 2.3.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
NOTE: Gem.gunzip is deprecated; use Gem::Util.gunzip instead. It will be removed on or after 2018-12-01.
Gem.gunzip called from /Users/adanamarillas/.rvm/gems/ruby-2.3.2/gems/unicode-display_width-1.3.0/lib/unicode/display_width/index.rb:5.
Missing translations (2) | i18n-tasks v0.9.20
+--------+----------------------------------------+-----------------------------------------------------+
| Locale | Key                                    | Value in other locales or source                    |
+--------+----------------------------------------+-----------------------------------------------------+
|  all   | admin.settings.index.no_banners_images | app/views/admin/settings/_banner_images.html.erb:23 |
|  all   | admin.settings.index.no_banners_styles | app/views/admin/settings/_banner_styles.html.erb:23 |
+--------+----------------------------------------+-----------------------------------------------------+

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

@aamarill That is because you referenced the keys on the views but forgot to add them under config/locales/en and config/locales/es

@aamarill
Copy link
Author

@aitbw Fixed! I am moving on to the last two tests that are failing.
I actually do speak Spanish, but I am not sure which translation is the best for:

no_banners_images: No banner images
no_banners_styles: No banner styles

FYI, these don't have a Spanish translation either:

banners: Banner style
banner_imgs: Banner images

@aitbw
Copy link
Collaborator

aitbw commented May 24, 2018

For the no_banners_images and no_banners_images keys, I think we'd need @decabeza's output here

For the keys that don't have a translation (we tend to miss those from time to time), feel free to add a commit as well fixing that 😸

@voodoorai2000 voodoorai2000 added this to Doing in Roadmap May 24, 2018
@voodoorai2000 voodoorai2000 removed this from Doing in Roadmap May 24, 2018
@decabeza
Copy link
Collaborator

Don't worry, the translation is perfect! 👌 😉

@aamarill
Copy link
Author

@decabeza Awesome! 🥂 Is there anything else we need before accepting/merging this PR? 😄

@decabeza decabeza changed the title 2586 split admin settings Split admin settings Jun 1, 2018
@decabeza decabeza merged commit ec58ada into consuldemocracy:master Jun 1, 2018
@PierreMesure
Copy link
Collaborator

Hey @aamarill! Really nice work you did here! I just wanted to warn you that updating a field in any of the tabs will always send you back to the first tab. It would be nice if it could stay on the tab after you update.

Also, I'm often having a bug on Safari macOS (latest): the content of the tabs doesn't appear when I switch. I doesn't happen on Chrome.

@aamarill
Copy link
Author

Thanks for the note @PierreMesure!
Unfortunately, I don't foresee having time to fix this in the near future.
Feel free to open an issue for it if you would like for someone to work on it.
It may even be a good "first-timer" contribution. Cheers!

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

5 participants