-
Notifications
You must be signed in to change notification settings - Fork 3
Promotions: navigation & exports #4156
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5eacc78
list cohorts in school
SebouChu 3e0ecb6
list cohorts in program
SebouChu 6402c66
add filters
SebouChu a13370d
WIP export
SebouChu 66ef9bd
cohorts: excel exports
SebouChu 83a0e5d
Ajout de la navigation
arnaudlevy acd2e88
Moved Cohorts & Academic Years in Administration realm
SebouChu 76d9fcd
fix
arnaudlevy 7499e5e
nav
arnaudlevy db954e1
move fixture
arnaudlevy 8213c45
fix
arnaudlevy a16562b
remove export_csv
arnaudlevy efe4fb8
remove
arnaudlevy bee258c
fix
arnaudlevy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/controllers/admin/administration/cohorts_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| class Admin::Administration::CohortsController < Admin::Administration::ApplicationController | ||
| load_and_authorize_resource class: Administration::Cohort, | ||
| through: :current_university, | ||
| through_association: :administration_cohorts, | ||
| except: :restore | ||
|
|
||
| include Admin::HasStaticAction | ||
| include Admin::Localizable | ||
|
|
||
| def index | ||
| @filtered = @cohorts.filter_by(params[:filters], current_language) | ||
| @cohorts = @filtered.at_lifecycle(params[:lifecycle], current_language) | ||
| .ordered | ||
|
|
||
| respond_to do |format| | ||
| format.html { | ||
| @cohorts = @cohorts.page(params[:page]) | ||
| breadcrumb | ||
| } | ||
| format.xlsx { | ||
| filename = "cohorts-#{Time.now.strftime("%Y%m%d%H%M%S")}.xlsx" | ||
| response.headers['Content-Disposition'] = "attachment; filename=#{filename}" | ||
| } | ||
| end | ||
| end | ||
|
|
||
| def show | ||
| breadcrumb | ||
| end | ||
|
|
||
| def destroy | ||
| program = @cohort.program | ||
| label = @cohort.to_s_in(current_language) | ||
| @cohort.destroy | ||
| redirect_back fallback_location: admin_administration_program_cohorts_path(program), | ||
| notice: t('admin.successfully_destroyed_html', model: label) | ||
| end | ||
|
|
||
| def restore | ||
| @cohort = current_university.administration_cohorts.only_deleted.find(params[:id]) | ||
| authorize!(:restore, @cohort) | ||
| @cohort.restore(recursive: true) | ||
| redirect_to admin_administration_cohort_path(@cohort), | ||
| notice: t('admin.successfully_restored_html', model: @cohort.to_s_in(current_language)) | ||
| end | ||
|
|
||
| protected | ||
|
|
||
| def breadcrumb | ||
| super | ||
| add_breadcrumb Administration::Cohort.model_name.human(count: 2), admin_administration_cohorts_path | ||
| breadcrumb_for @cohort | ||
| end | ||
|
|
||
| def cohort_params | ||
| params.require(:administration_cohort) | ||
| .permit(:program_id, :academic_year_id, :name) | ||
| end | ||
| end |
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
app/controllers/admin/education/programs/cohorts_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| class Admin::Education::Programs::CohortsController < Admin::Education::Programs::ApplicationController | ||
| load_and_authorize_resource class: Administration::Cohort, through: :program, through_association: :administration_cohorts | ||
|
|
||
| include Admin::Localizable | ||
|
|
||
| def index | ||
| @filtered = @cohorts.filter_by(params[:filters], current_language) | ||
| @cohorts = @filtered.at_lifecycle(params[:lifecycle], current_language) | ||
| .ordered | ||
|
|
||
| respond_to do |format| | ||
| format.html { | ||
| @cohorts = @cohorts.page(params[:page]) | ||
| breadcrumb | ||
| } | ||
| format.xlsx { | ||
| filename = "cohorts-#{Time.now.strftime("%Y%m%d%H%M%S")}.xlsx" | ||
| response.headers['Content-Disposition'] = "attachment; filename=#{filename}" | ||
| render "admin/administration/cohorts/index" | ||
| } | ||
| end | ||
| end | ||
|
|
||
| protected | ||
|
|
||
| def breadcrumb | ||
| super | ||
| add_breadcrumb Administration::Cohort.model_name.human(count: 2) | ||
| end | ||
|
|
||
| end | ||
|
arnaudlevy marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/controllers/admin/education/schools/cohorts_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| class Admin::Education::Schools::CohortsController < Admin::Education::Schools::ApplicationController | ||
| load_and_authorize_resource class: Administration::Cohort, through: :school, through_association: :administration_cohorts | ||
|
|
||
| include Admin::Localizable | ||
|
|
||
| def index | ||
| @filtered = @cohorts.filter_by(params[:filters], current_language) | ||
| @cohorts = @filtered.at_lifecycle(params[:lifecycle], current_language) | ||
| .ordered | ||
|
|
||
| respond_to do |format| | ||
| format.html { | ||
| @cohorts = @cohorts.page(params[:page]) | ||
| breadcrumb | ||
| } | ||
| format.xlsx { | ||
| filename = "cohorts-#{Time.now.strftime("%Y%m%d%H%M%S")}.xlsx" | ||
| response.headers['Content-Disposition'] = "attachment; filename=#{filename}" | ||
| render "admin/administration/cohorts/index" | ||
| } | ||
| end | ||
| end | ||
|
|
||
| protected | ||
|
|
||
| def breadcrumb | ||
| super | ||
| add_breadcrumb Administration::Cohort.model_name.human(count: 2) | ||
| end | ||
|
|
||
| end | ||
|
SebouChu marked this conversation as resolved.
arnaudlevy marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.