aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/application.sass4
-rw-r--r--app/assets/stylesheets/base/_utilities.sass15
-rw-r--r--app/assets/stylesheets/components/_form.sass30
-rw-r--r--app/assets/stylesheets/components/_forms.sass77
-rw-r--r--app/assets/stylesheets/partials/footer.sass15
-rw-r--r--app/controllers/workbenches_controller.rb11
-rw-r--r--app/views/workbenches/show.html.slim15
7 files changed, 117 insertions, 50 deletions
diff --git a/app/assets/stylesheets/application.sass b/app/assets/stylesheets/application.sass
index 98c817647..263302926 100644
--- a/app/assets/stylesheets/application.sass
+++ b/app/assets/stylesheets/application.sass
@@ -3,6 +3,7 @@
//----------//
@import 'base/config'
+@import 'base/utilities'
@import 'typography/fonts'
@import 'typography/typography'
@@ -10,7 +11,10 @@
@import 'layout'
@import 'components/buttons'
+@import 'components/select2'
+@import 'components/forms'
@import 'components/tables'
@import 'components/pagination'
@import 'components/main_nav'
@import 'components/page_header'
+@import 'components/loader'
diff --git a/app/assets/stylesheets/base/_utilities.sass b/app/assets/stylesheets/base/_utilities.sass
new file mode 100644
index 000000000..4441b77db
--- /dev/null
+++ b/app/assets/stylesheets/base/_utilities.sass
@@ -0,0 +1,15 @@
+//-------------//
+// Utilities //
+//-------------//
+
+.mt-xs
+ margin-top: 10px
+
+.mt-sm
+ margin-top: 15px
+
+.mt-md
+ margin-top: 20px
+
+.mt-lg
+ margin-top: 40px
diff --git a/app/assets/stylesheets/components/_form.sass b/app/assets/stylesheets/components/_form.sass
deleted file mode 100644
index 97e92942e..000000000
--- a/app/assets/stylesheets/components/_form.sass
+++ /dev/null
@@ -1,30 +0,0 @@
-//-------//
-// FORMS //
-//-------//
-
-.form-control
- &.form-control-link
- &:hover, &:focus
- // Reset default link styles
- text-decoration: none
- color: inherit
- // Add custom
- color: #555
- background-color: #f5f5f5
-
-// Validations
-.control-label
- &.is-required
- &:after
- content: ' *'
- display: inline
- color: #a94442
-
-.form-control
- &:required
- &:focus:invalid
- border-color: #d43f3a
- box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #d9534f
- &:focus:valid
- border-color: #4cae4c
- box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #5cb85c
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass
new file mode 100644
index 000000000..9ef1fd6d4
--- /dev/null
+++ b/app/assets/stylesheets/components/_forms.sass
@@ -0,0 +1,77 @@
+//-------//
+// FORMS //
+//-------//
+
+.form-control
+ &.form-control-link
+ &:hover, &:focus
+ // Reset default link styles
+ text-decoration: none
+ color: inherit
+ // Add custom
+ color: #555
+ background-color: #f5f5f5
+
+// Validations
+.control-label
+ &.is-required
+ &:after
+ content: ' *'
+ display: inline
+ color: #a94442
+
+.form-control
+ &:required
+ &:focus:invalid
+ border-color: #d43f3a
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #d9534f
+ &:focus:valid
+ border-color: #4cae4c
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #5cb85c
+
+// Search bar
+.page_header
+ .search_bar
+ position: relative
+ width: 100%
+
+
+ > .form-control
+ background-color: rgba(#fff, 0.15)
+ color: #fff
+ border: none
+ border-radius: 4px
+ padding-right: 31px
+
+ &::-moz-placeholder
+ color: rgba(#fff, 0.65)
+ font-style: italic
+ &::-webkit-input-placeholder
+ color: rgba(#fff, 0.65)
+ font-style: italic
+ &:-ms-input-placeholder
+ color: rgba(#fff, 0.65)
+ font-style: italic
+ &::-ms-input-placeholder
+ color: rgba(#fff, 0.65)
+ font-style: italic
+
+ &:focus, &:active
+ box-shadow: none
+
+ .input-group-btn
+ position: absolute
+ top: 0
+ bottom: 0
+ right: 0
+ z-index: 2
+ width: auto
+
+ > .btn
+ margin: 0
+ padding: 6px 9px
+ border: none
+ border-radius: 0
+ background-color: transparent
+ color: #fff
+ height: 100%
diff --git a/app/assets/stylesheets/partials/footer.sass b/app/assets/stylesheets/partials/footer.sass
deleted file mode 100644
index f58e1e04e..000000000
--- a/app/assets/stylesheets/partials/footer.sass
+++ /dev/null
@@ -1,15 +0,0 @@
-#footer
- padding: 20px
- background-color: $gray-darker
- color: $gray-light
- font-size: 12px
- min-height: 200px
-
- a
- color: $gray-light
-
- h4
- color: $gray-lighter
-
- .logo > img
- margin-left: 20px \ No newline at end of file
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index bca1ed032..772c79449 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -4,13 +4,16 @@ class WorkbenchesController < BreadcrumbController
respond_to :html, :only => [:show]
def show
- @wbench_refs = if params[:show_all]
- Workbench.find(params[:id]).all_referentials.order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 30)
+ if params[:show_all]
+ @q = Workbench.find(params[:id]).all_referentials.ransack(params[:q])
else
- Workbench.find(params[:id]).referentials.ready.order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 30)
- # Workbench.find(params[:id]).referentials.order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 30)
+ @q = Workbench.find(params[:id]).referentials.ready.ransack(params[:q])
+ # @q = Workbench.find(params[:id]).referentials.ransack(params[:q])
end
+ @collection = @q.result(distinct: true)
+ @wbench_refs = @collection.order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 30)
+
show! do
build_breadcrumb :show
end
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index 95668bce3..022119db7 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -6,7 +6,7 @@
/ Below is secundary actions & optional contents (filters, ...)
.row
- .col-lg-12.col-md-12.col-sm-12.col-xs-12.text-right
+ .col-lg-12.text-right
- if params[:show_all]
= link_to t('referentials.show.from_this_workbench'), workbench_path(@workbench.id), class: 'btn btn-primary', disabled: params[:archived]
- else
@@ -14,6 +14,19 @@
= link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
+ .row.mt-xs
+ .col-lg-5.col-md-6.col-sm-6.col-xs-8
+ = search_form_for @q, url: workbench_path(@workbench.id), html: { method: :get, class: 'form'} do |f|
+ .input-group.search_bar
+ = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de JDD ou transporteur'
+
+ span.input-group-btn
+ button.btn.btn-default type='submit'
+ span.fa.fa-search
+
+ / br
+ / = "filtres par: etat, orga, nb lignes, plage de validité, date publi. btns: clear filter et filtrer"
+
/ PageContent
.page_content
.container-fluid