diff options
| author | Robert | 2017-04-20 17:09:23 +0200 |
|---|---|---|
| committer | Robert | 2017-04-20 17:09:23 +0200 |
| commit | 915e7209cb85ea41e76da6a1f026963fabc5eba0 (patch) | |
| tree | b39529be859098a9364510bcedbf6d27a3b61f7e | |
| parent | d8172e2e36d874b72e2784bb92f273fe8457741e (diff) | |
| parent | 59e923453231927d9aa46fbd22576475a3f3c0ee (diff) | |
| download | chouette-core-915e7209cb85ea41e76da6a1f026963fabc5eba0.tar.bz2 | |
Merge branch 'master' of github.com:af83/stif-boiv
12 files changed, 234 insertions, 86 deletions
diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index a023360a5..de359b99e 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -74,7 +74,7 @@ const actions = { let M = actions.monthName(strDate).toLowerCase() let Y = origin[0] - if(mLimit) { + if(mLimit && M.length > mLimit) { M = M.substr(0, mLimit) + '.' } diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js b/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js index df8c6e844..5db373f9c 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js @@ -16,44 +16,68 @@ let Navigate = ({ dispatch, metas, timetable, pagination, status, filters}) => { <div className="row mt-md"> <div className="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 text-right"> <div className="pagination"> - <form className='page_links' onSubmit={e => {e.preventDefault()}}> - <select - value={pagination.currentPage} - onChange={(e)=>{ - e.preventDefault() - dispatch(actions.checkConfirmModal(e, actions.changePage(dispatch, pagination, e.currentTarget.value), pagination.stateChanged, dispatch)) - }} - > - {_.map(pagination.periode_range, (month, i) => ( - <option - value={month} - key={i} + <form className='form-inline' onSubmit={e => {e.preventDefault()}}> + {/* date selector */} + <div className="form-group"> + <div className="dropdown month_selector" style={{display: 'inline-block'}}> + <div + className='btn btn-default dropdown-toggle' + id='date_selector' + data-toggle='dropdown' + aria-haspopup='true' + aria-expanded='true' + > + {pagination.currentPage ? (actions.monthName(pagination.currentPage) + ' ' + new Date(pagination.currentPage).getFullYear()) : ''} + <span className='caret'></span> + </div> + <ul + className='dropdown-menu' + aria-labelledby='date_selector' > - {actions.monthName(month) + ' ' + new Date(month).getFullYear()} - </option> - ))} - </select> - <button - onClick={e => { - e.preventDefault() - dispatch(actions.checkConfirmModal(e, actions.goToPreviousPage(dispatch, pagination), pagination.stateChanged, dispatch)) - }} - type='button' - data-target='#ConfirmModal' - className={(firstPage ? 'disabled ' : '') + 'previous_page'} - disabled={(firstPage ? 'disabled' : '')} - ></button> - <button - onClick={e => { - e.preventDefault() - dispatch(actions.checkConfirmModal(e, actions.goToNextPage(dispatch, pagination), pagination.stateChanged, dispatch)) - }} - type='button' - data-target='#ConfirmModal' - className={(lastPage ? 'disabled ' : '') + 'next_page'} - disabled={(lastPage ? 'disabled' : '')} - ></button> - </form> + {_.map(pagination.periode_range, (month, i) => ( + <li key={i}> + <button + type='button' + value={month} + onClick={e => { + e.preventDefault() + dispatch(actions.checkConfirmModal(e, actions.changePage(dispatch, pagination, e.currentTarget.value), pagination.stateChanged, dispatch)) + }} + > + {actions.monthName(month) + ' ' + new Date(month).getFullYear()} + </button> + </li> + ))} + </ul> + </div> + </div> + + {/* prev/next */} + <div className="form-group"> + <div className="page_links"> + <button + onClick={e => { + e.preventDefault() + dispatch(actions.checkConfirmModal(e, actions.goToPreviousPage(dispatch, pagination), pagination.stateChanged, dispatch)) + }} + type='button' + data-target='#ConfirmModal' + className={(firstPage ? 'disabled ' : '') + 'previous_page'} + disabled={(firstPage ? 'disabled' : '')} + ></button> + <button + onClick={e => { + e.preventDefault() + dispatch(actions.checkConfirmModal(e, actions.goToNextPage(dispatch, pagination), pagination.stateChanged, dispatch)) + }} + type='button' + data-target='#ConfirmModal' + className={(lastPage ? 'disabled ' : '') + 'next_page'} + disabled={(lastPage ? 'disabled' : '')} + ></button> + </div> + </div> + </form> </div> </div> </div> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js index 61098d9ea..01996b016 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js @@ -14,7 +14,41 @@ class PeriodManager extends Component { className='period_manager' id={this.props.value.id} > - <strong>{(this.props.value.period_start.split('-')[2]) + ' > ' + actions.getHumanDate(this.props.value.period_end, 3)}</strong> + <p className='strong'> + {actions.getHumanDate(this.props.value.period_start, 3).substr(0, 7) + ' > ' + actions.getHumanDate(this.props.value.period_end, 3)} + </p> + + <div className='dropdown'> + <div + className='btn dropdown-toggle' + id='period_actions' + data-toggle='dropdown' + aria-haspopup='true' + aria-expanded='true' + > + <span className='fa fa-cog'></span> + </div> + <ul + className='dropdown-menu' + aria-labelledby='date_selector' + > + <li> + <button + type='button' + > + Modifier + </button> + </li> + <li className='delete-action'> + <button + type='button' + > + <span className='fa fa-trash'></span> + Supprimer + </button> + </li> + </ul> + </div> </div> ) } diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js index adc500c86..901b2205e 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js @@ -41,7 +41,7 @@ class PeriodsInDay extends Component { let d = this.props.currentDate.getTime() if(d >= begin && d <= end) { - if(d == begin) { + if(d == begin || (this.props.currentDate.getUTCDate() == 1)) { return ( <PeriodManager key={i} diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js index cc47c2052..eecdf174d 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js @@ -17,7 +17,7 @@ class TimeTableDay extends Component { {((this.props.value.day).charAt(0) == 'm') ? (this.props.value.day).substr(0, 2) : (this.props.value.day).charAt(0)} </span> <span - className={'daynumber' + (this.props.value.in_periods ? ' included' : '')} + className={'daynumber' + ((this.props.value.in_periods && this.props.dayTypeActive) ? ' included' : '')} > {this.props.value.mday} </span> @@ -28,7 +28,8 @@ class TimeTableDay extends Component { TimeTableDay.propTypes = { value: PropTypes.object.isRequired, - index: PropTypes.number.isRequired + index: PropTypes.number.isRequired, + dayTypeActive: PropTypes.bool.isRequired } module.exports = TimeTableDay diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js index b27dddbf1..738e1a3ed 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js @@ -19,26 +19,6 @@ class Timetable extends Component{ return currentDate } - componentDidUpdate(prevProps, prevState) { - if(this.props.status.isFetching == false){ - $('.table-2entries').each(function() { - var refH = [] - var refCol = [] - - $(this).find('.t2e-head').children('.td').each(function() { - var h = $(this).outerHeight(); - refH.push(h) - }); - - $(this).find('.t2e-item').children('.td-group').each(function() { - for(var nth = 0; nth < refH.length; nth++) { - $(this).find('.td:nth-child('+ (nth + 1) +')').css('height', refH[nth]); - } - }); - }); - } - } - render() { return ( <div className='row'> @@ -48,9 +28,9 @@ class Timetable extends Component{ <div className="th"> <div className="strong">Synthèse</div> </div> - <div className="td">Journées d'application</div> - <div className="td">Périodes</div> - <div className="td">Exceptions</div> + <div className="td"><span>Journées d'application</span></div> + <div className="td"><span>Périodes</span></div> + <div className="td"><span>Exceptions</span></div> </div> <div className="t2e-item-list w80"> <div> @@ -66,6 +46,7 @@ class Timetable extends Component{ key={i} index={i} value={d} + dayTypeActive={this.props.metas.day_types[d.wday]} /> )} </div> diff --git a/app/assets/stylesheets/components/_buttons.sass b/app/assets/stylesheets/components/_buttons.sass index 07758d56c..342e6503d 100644 --- a/app/assets/stylesheets/components/_buttons.sass +++ b/app/assets/stylesheets/components/_buttons.sass @@ -117,7 +117,6 @@ table, .table padding: 5px 15px > li.delete-action - > a, > button display: block position: relative diff --git a/app/assets/stylesheets/components/_dropdown.sass b/app/assets/stylesheets/components/_dropdown.sass index eb2cc8f74..99dc6292e 100644 --- a/app/assets/stylesheets/components/_dropdown.sass +++ b/app/assets/stylesheets/components/_dropdown.sass @@ -14,9 +14,11 @@ &:hover, &:focus color: #262626 background-color: whitesmoke + outline: none > .disabled > a, > .disabled > button cursor: not-allowed &, &:hover, &:focus color: rgba($darkgrey, 0.5) background-color: transparent + outline: none diff --git a/app/assets/stylesheets/modules/_timetables.sass b/app/assets/stylesheets/modules/_timetables.sass index e44a254c5..2b430fb6a 100644 --- a/app/assets/stylesheets/modules/_timetables.sass +++ b/app/assets/stylesheets/modules/_timetables.sass @@ -3,15 +3,30 @@ //---------------// #periods - .t2e-head > .th - height: 135px - text-align: left - border-color: $darkgrey - border-top-width: 2px + .t2e-head + > .th + height: 135px + text-align: left + border-color: $darkgrey + border-top-width: 2px + + > .strong + padding-top: 123px + transform: translateY(-1.4em) + + .t2e-head > .td, .t2e-item > .td-group > .td + height: 65px - > .strong - padding-top: 123px - transform: translateY(-1.4em) + .t2e-head > .td + line-height: 50px + + > span + display: inline-block + vertical-align: middle + line-height: 1.4 + + .t2e-item-list > div + border-color: #fff .t2e-item .th @@ -59,7 +74,7 @@ background-color: transparent &.included - background-color: rgba($gold, 0.7) + background-color: rgba($gold, 0.5) > .td-group width: 34px @@ -76,15 +91,36 @@ > .td &.in_periods - background-color: rgba($gold, 0.7) - border-left-color: rgba($gold, 0.7) - border-right-color: rgba($gold, 0.7) + background-color: rgba($gold, 0.5) + border-left-color: rgba($gold, 0.5) + border-right-color: rgba($gold, 0.5) &.start_period border-left-color: rgba($grey, 0.5) &.end_period border-right-color: rgba($grey, 0.5) + .form-group > .month_selector + > .btn.btn-default + background-color: rgba($grey, 0.15) + color: $darkgrey + border: none + border-radius: 0 + padding: 8px 15px 7px 15px + + &:active, &.active + box-shadow: none + + > .caret + margin-left: 10px + color: $blue + + > .dropdown-menu + margin-top: 1px + border-radius: 0 0 4px 4px + max-height: 230px + overflow: auto + .period_manager display: block height: auto @@ -92,5 +128,68 @@ white-space: nowrap position: absolute left: 8px - top: 6px + top: 50% + transform: translateY(-50%) z-index: 5 + + > * + display: inline-block + vertical-align: middle + margin: 0 + + &.dropdown + margin-left: 5px + + .btn.dropdown-toggle + color: $blue + background-color: rgba(#fff, 0) + padding: 1px 5px + border-radius: 0 + transition: 0.2s + + &:hover, &:focus, &:active, &.active + background-color: rgba(#fff, 1) + border-color: $blue + outline: none + box-shadow: none + transition: 0.2s + + .open > .btn.dropdown-toggle + background-color: rgba(#fff, 1) + border-color: $blue + box-shadow: none + transition: 0.2s + + .dropdown-menu + margin: 0 + border-radius: 0 + box-shadow: 0 0 3px rgba($darkgrey, 0.25) + min-width: 120px + + > li > a, > li > button + padding: 5px 15px + + > li.delete-action + > a, > button + display: block + position: relative + margin-top: 11px + + &:before + content: '' + display: block + position: absolute + left: 15px + right: 15px + top: -6px + height: 1px + background-color: $grey + + .fa:first-child + margin-right: 0.5em + + .td-group.last_wday ~ .td-group.last_wday ~ .td-group.last_wday ~ .td-group.last_wday + > .td, ~ .td-group > .td + > .period_manager .dropdown-menu + left: auto + right: 0 diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index c68a60804..accf119a3 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,9 +1,14 @@ class ErrorsController < ApplicationController def not_found - render :status => 404, :formats => [:html] + render template: 'errors/not_found', status: 404, formats: [:html] end def server_error - render :status => 500, :formats => [:html] + render template: 'errors/server_error', status: 500, formats: [:html] end -end
\ No newline at end of file + + def not_allowed + render template: 'errors/not_found', status: 403, formats: [:html] + end +end + diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index b46cf09a4..1025c1658 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -7,6 +7,7 @@ / Below is secundary actions & optional contents (filters, ...) .row.mb-sm .col-lg-12.text-right + = link_to Import.model_name.human.pluralize.capitalize, workbench_imports_path(@workbench), class: 'btn btn-primary' - if policy(Referential).create? = link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary' diff --git a/config/routes.rb b/config/routes.rb index a8c332fb8..538c069ed 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -213,9 +213,11 @@ ChouetteIhm::Application.routes.draw do get '/help/(*slug)' => 'help#show' - get '/404', to: 'errors#not_found' - get '/403', to: 'errors#not_allowed' - get '/422', to: 'errors#server_error' - get '/500', to: 'errors#server_error' + if Rails.env.production? + get '404', to: 'errors#not_found' + get '403', to: 'errors#not_allowed' + get '422', to: 'errors#server_error' + get '500', to: 'errors#server_error' + end end |
