Skip to content
Snippets Groups Projects

Simplify controllers and layout handling

Merged gitlab-qa-bot requested to merge github/fork/jouve/simplify_controllers2 into master

Created by: jouve

Controllers related to projects (Projects, Commits, Hooks, ...) share common code (layout :project, before_filters :project and :add_project_abilites), so I created a ProjectController < ApplicationController to put this common code and made all ProjectsController, CommitsController, HooksController, ... inherit this ProjectController.

Second commit removes most of layout calls to use default rails layout logic (layout with same name as controller).

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: dzaporozhets

    @jouve can you make it mergeable please :)

    By Administrator on 2012-09-27T08:31:50 (imported from GitLab project)

    By Administrator on 2012-09-27T08:31:50 (imported from GitLab)

  • Created by: rspeicher

    Is authorize_read_project! another filter that can be moved to the parent class? I'm not sure it's in every controller, but it might be.

    By Administrator on 2012-09-27T14:51:14 (imported from GitLab project)

    By Administrator on 2012-09-27T14:51:14 (imported from GitLab)

  • Created by: dzaporozhets

    @tsigo is right. we can move it to project controller too. Also i am confused with ProjectController name. Especially when ProjectsController < ProjectController Maybe something like ProjectBaseController? What do you think?

    By Administrator on 2012-09-27T16:43:55 (imported from GitLab project)

    By Administrator on 2012-09-27T16:43:55 (imported from GitLab)

  • Created by: rspeicher

    @randx Yeah, I was going to include something like this in my routing changes, but couldn't come up with a good name. :smile:

    ProjectResourceController was the best I came up with.

    Also I don't think ProjectsController should inherit from this new controller, just for the sake of clarity. If we duplicate a few lines in one controller, so be it.

    By Administrator on 2012-09-27T16:46:30 (imported from GitLab project)

    By Administrator on 2012-09-27T16:46:30 (imported from GitLab)

  • Created by: dzaporozhets

    +1 not to inherit ProjectsController from this new one. Also ProjectResourceController is not bad.

    By Administrator on 2012-09-27T16:54:52 (imported from GitLab project)

    By Administrator on 2012-09-27T16:54:52 (imported from GitLab)

  • Created by: dzaporozhets

    on in java style like AbstractProjectBaseControllerForNestedResourcePersistenceProxy :smile:

    By Administrator on 2012-09-27T17:00:42 (imported from GitLab project)

    By Administrator on 2012-09-27T17:00:42 (imported from GitLab)

  • Created by: jouve

    Some controllers do not have authorize_read_project! filter (issues, labels, ...)

    By Administrator on 2012-09-27T19:28:44 (imported from GitLab project)

    By Administrator on 2012-09-27T19:28:44 (imported from GitLab)

  • Created by: rspeicher

    :thumbsup: Looks good!

    By Administrator on 2012-09-27T19:44:16 (imported from GitLab project)

    By Administrator on 2012-09-27T19:44:16 (imported from GitLab)

Please register or sign in to reply
Loading