[#369] project sections page

This commit is contained in:
Alexander Machehin 2014-11-12 22:30:27 +05:00
parent bc0b196319
commit f4eb6de8b0
5 changed files with 21 additions and 26 deletions

View File

@ -1,7 +1,7 @@
class Projects::ProjectsController < Projects::BaseController class Projects::ProjectsController < Projects::BaseController
include DatatableHelper include DatatableHelper
include ProjectsHelper include ProjectsHelper
layout 'bootstrap', only: [:index, :new, :create, :edit, :update] layout 'bootstrap', only: [:index, :new, :create, :edit, :update, :sections]
before_filter :authenticate_user! before_filter :authenticate_user!
load_and_authorize_resource id_param: :name_with_owner # to force member actions load load_and_authorize_resource id_param: :name_with_owner # to force member actions load
before_filter :who_owns, only: [:new, :create, :mass_import, :run_mass_import] before_filter :who_owns, only: [:new, :create, :mass_import, :run_mass_import]
@ -130,7 +130,7 @@ class Projects::ProjectsController < Projects::BaseController
end end
def sections def sections
if request.post? if request.patch?
if @project.update_attributes(params[:project]) if @project.update_attributes(params[:project])
flash[:notice] = t('flash.project.saved') flash[:notice] = t('flash.project.saved')
redirect_to sections_project_path(@project) redirect_to sections_project_path(@project)

View File

@ -38,7 +38,7 @@
= link_to t('project_menu.wiki'), project_wiki_index_path(@project) = link_to t('project_menu.wiki'), project_wiki_index_path(@project)
%li=# link_to t('project_menu.readme'), '#' #pending %li=# link_to t('project_menu.readme'), '#' #pending
- if can? :update, @project - if can? :update, @project
%li{ class: ('active' if act == :edit && contr == :projects) } %li{ class: ('active' if act.in?(%i[edit update sections]) && contr == :projects) }
= link_to t('project_menu.settings'), edit_project_path(@project) = link_to t('project_menu.settings'), edit_project_path(@project)
/ /.navbar-collapse / /.navbar-collapse
/ /.container-fluid / /.container-fluid

View File

@ -46,7 +46,7 @@ div ng-controller = 'ProjectFromController' ng-cloak = 'true'
= f.input :srpm, as: :file = f.input :srpm, as: :file
.col-sm-offset-3.col-sm-9 .col-sm-offset-3.col-sm-9
= f.button :submit, t('layout.save') = f.button :submit, t('layout.save'), data: {'disable-with' => t('layout.saving')}
- content_for :additional_scripts do - content_for :additional_scripts do
javascript: javascript:

View File

@ -1,25 +1,20 @@
-set_meta_tags title: [title_object(@project), t('layout.projects.sections')] -set_meta_tags title: [title_object(@project), t('layout.projects.sections')]
= render 'submenu' = render 'submenu'
= render 'sidebar'
= form_for @project, url: sections_project_path(@project), method: :post, html: { class: :form, multipart: true } do |f| .container.col-md-offset-2.col-md-8
.leftside.w25 .row
%span.niceCheck-main{onclick: "changeCheck(this)"}= f.check_box :has_issues = render 'settings_menu'
.leftside.w420
= t("activerecord.attributes.project.has_issues")
%br
%span{style: "font-size: 11px;"}= t("layout.projects.has_issue_description")
.both
.leftside.w25
%span.niceCheck-main{onclick: "changeCheck(this)"}= f.check_box :has_wiki, class: 'niceCheck-main'
.leftside.w420
= t("activerecord.attributes.project.has_wiki")
%br
%span{style: "font-size: 11px;"}= t("layout.projects.has_wiki_description")
.both
.padd25= submit_tag t('layout.save'), class: 'button', data: {'disable-with' => t('layout.saving')}
.both
:javascript = simple_form_for @project, url: sections_project_path(@project),
// TODO: Replace this temporary hack by something more true html: { class: 'form-horizontal' },
$('.right').addClass('bigpadding'); wrapper: :horizontal_form,
wrapper_mappings: { boolean: :horizontal_boolean } do |f|
= f.input :has_issues, as: :boolean,
hint: t('layout.projects.has_issue_description')
= f.input :has_wiki, as: :boolean,
hint: t('layout.projects.has_wiki_description')
.col-sm-offset-3.col-sm-9
= f.button :submit, t('layout.save'), data: {'disable-with' => t('layout.saving')}

View File

@ -356,7 +356,7 @@ Rosa::Application.routes.draw do
post '/fork' => 'projects#fork', as: :fork_project post '/fork' => 'projects#fork', as: :fork_project
get '/possible_forks' => 'projects#possible_forks', as: :possible_forks_project get '/possible_forks' => 'projects#possible_forks', as: :possible_forks_project
get '/sections' => 'projects#sections', as: :sections_project get '/sections' => 'projects#sections', as: :sections_project
post '/sections' => 'projects#sections' patch '/sections' => 'projects#sections'
delete '/remove_user' => 'projects#remove_user', as: :remove_user_project delete '/remove_user' => 'projects#remove_user', as: :remove_user_project
# constraints treeish: /[\w\-\.]+(\/[\w\-\.]+)?/ do # constraints treeish: /[\w\-\.]+(\/[\w\-\.]+)?/ do
constraints treeish: /.+/ do constraints treeish: /.+/ do