Skip to content
Snippets Groups Projects

Fix the Cancel button on the Edit Wiki page.

Merged gitlab-qa-bot requested to merge github/fork/DanKnox/fix_wiki_cancel_edit_button into master

Created by: DanKnox

The Cancel button on the Edit Wiki page was still redirecting back to the "Index" page which is no longer the default Wiki page.

This commit changes the Cancel button in the following ways:

  • Pressing Cancel while editing an existing Wiki page will now redirect you back to the latest version of that page.
  • Pressing Cancel while editing a brand new Wiki home page that does not yet exist will redirect you to back to the same Edit Wiki Home page.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: coveralls

    Coverage decreased (-0.11%) when pulling 8300ae36 on DanKnox:fix_wiki_cancel_edit_button into 6880ace1 on gitlabhq:master.

    View Details

    By Administrator on 2013-03-20T05:10:06 (imported from GitLab project)

    By Administrator on 2013-03-20T05:10:06 (imported from GitLab)

  • Created by: DanKnox

    I really like what you guys have done with the navigation changes for the Wiki. I actually already had a pull request lined up to change the navigation in a similar way, including adding a "New Page" button.

    One small note, the New Page button that you do have has a bug if you enter a page title with spaces in them. I ran into this when implementing my version of it. I believe this is why Github uses the Wiki name as a parameter for the create page instead of using the id in the path like we are. The URL encoded %20 spaces seem to screw up Rails' routing.

    You can fix this by turning the page title into a slug in the JavaScript with the following:

    // in app/views/wiki/_new.html.haml # line 18
    $('.build-new-wiki').bind("click", function() {
      var pageTitle = $('#new_wiki_path').val().replace(/\s+/g, '-').toLowerCase();
      var escapedTitle = encodeURIComponent(pageTitle);
      location.href = "#{project_wikis_path(@project)}/" + escapedTitle;
    });

    I would also recommend adding support for submitting the form by hitting the 'enter' key, which is very convenient.

    $('#new_wiki_path').keypress(function(e) {
      if (e.keyCode == 13) {
        e.preventDefault();
        $('.build-new-wiki').click();
      }
    }

    I don't mind submitting a pull request with these changes if you guys are too busy to make these modifications.

    Last comment... and this is really just a nitpick that I probably shouldn't mention... but you have bootstrap modals already built into the app that look so much better than the jQuery ui modals. Why would you use jQuery ui over bootstrap?

    Here is what my new wiki page modal looked like:

    New Wiki Modal

    Here is the current implementation:

    Current New Wiki Modal

    Granted both could use some work but I personally favor the bootstrap modals.

    Thanks again for accepting all of my pull requests thus far. I know there are still a few outstanding issues with the Wiki system and I will get those taken care of as soon as I have time.

    By Administrator on 2013-03-20T05:12:44 (imported from GitLab project)

    By Administrator on 2013-03-20T05:12:44 (imported from GitLab)

  • Created by: DanKnox

    I also added more spinach coverage for the Cancel button in this pull request, although that's probably obvious by looking at the files changed tab.

    By Administrator on 2013-03-20T05:29:11 (imported from GitLab project)

    By Administrator on 2013-03-20T05:29:11 (imported from GitLab)

  • Created by: dzaporozhets

    @DanKnox thank you. You PR with changed described is appreciated. One thing I dont get is about JQuery UI. I think I use bootstrap modal. Why do you think I use jquery ui modal?

    By Administrator on 2013-03-20T07:28:57 (imported from GitLab project)

    By Administrator on 2013-03-20T07:28:57 (imported from GitLab)

  • Created by: rriemann

    @DanKnox :thumbsup:

    By Administrator on 2013-03-20T11:46:24 (imported from GitLab project)

    By Administrator on 2013-03-20T11:46:24 (imported from GitLab)

  • Created by: DanKnox

    @randx wow looking at the two modals side by side again this morning makes me feel a little ridiculous. I sent that pull request way too late last night and for some reason I could have sworn the Modal you used looked like the jquery ui modals. Looking at it now it is quite obvious the only difference between yours and mine is the font size and location of the "Page Slug" form label. :blush:

    I know you do have jquery ui modals available in the code base already and without using the bootstrap animation of the modal popping in from the top and the lack of the background fade made the interaction with the modal feel a whole lot like the jquery ui modal.

    I guess what I am really in favor of is enabling the animation and background fade. Without it Modals don't quite feel right to me. Also, I like the form label location above the form field better than where I placed it on my page, however I do think the font size should be significantly larger. Perhaps that was the other indicator that threw me off last night. Jquery UI modals always have that terrible tiny font for the entire modal, even the title.

    As always, thanks for accepting the pull request and putting up with my feedback even when it is way off base. :thumbsup:

    By Administrator on 2013-03-20T15:12:00 (imported from GitLab project)

    By Administrator on 2013-03-20T15:12:00 (imported from GitLab)

Please register or sign in to reply
Loading