para 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f89735619264be8599e3ccccfccdb64d07aa219c
4
- data.tar.gz: 7aea1f82a1e545b142dc4abcca505de107a3d94d
3
+ metadata.gz: ea023e2c7951df293b131af9c362b630a80acedb
4
+ data.tar.gz: e4a5edf55b4d9a1f98a7deac738a28169c227dfa
5
5
  SHA512:
6
- metadata.gz: cc137eb9e0185c8a7fac27b9ddb830981bcfa0e7b1951153beed16f4cc289efd3c5b6f467ee793cf9920aa02e9ed407f677b494fffa04fb60cff7ea85d69cfe6
7
- data.tar.gz: 7d2b0d6a005b9a2770bf28a459fe34c8ca4cddd8276cb58f3df99923131a96f24e99903850d8867de76778b3a771ced22ed49b6bc95f4c4062768d360880a55b
6
+ metadata.gz: ac5856d930a5a18d535b5a5636809598ab4676a2f349523265edf1a87bdfdfb7efc5f94ad720315468d56c55b46895f5184ace70f4a95b719747437f1758a37d
7
+ data.tar.gz: e001063051553067ba717acb4900368bfd054b97a46e7ea8bbdbdbc0e70369e22d8dbfe41cd53437bbfd545434b968688c61d494847ea234ae8f45f8c383f016
@@ -36,7 +36,7 @@ class Para.Tabs extends Vertebra.View
36
36
  @refreshTabErrors($tab)
37
37
 
38
38
  findTab: (id) ->
39
- id = id.replace(/^\#/, '')
39
+ id = "##{ id }" unless id.indexOf('#') >= 0
40
40
  @$('a[href="' + id + '"]')
41
41
 
42
42
  $(document).on 'page:change turbolinks:load', ->
@@ -62,9 +62,13 @@ legend
62
62
  .tab-pane
63
63
  +clearfix
64
64
  .form-group:last-of-type,
65
- .form-group:only-child
65
+ .form-group:only-child,
66
+ .nested-one-field:last-of-type
66
67
  margin-bottom: 0
67
68
 
69
+ .nested-one-field
70
+ margin-bottom: $form-group-margin-bottom
71
+
68
72
  .form-control
69
73
  font-size: 14px
70
74
 
@@ -112,6 +116,8 @@ legend
112
116
  //** Redactor
113
117
  .redactor-editor
114
118
  +outline-input-form
119
+ strong, b
120
+ font-weight: 700
115
121
 
116
122
  .redactor-toolbar
117
123
  border: none
@@ -194,6 +200,7 @@ legend
194
200
  position: fixed
195
201
  bottom: 0px
196
202
  right: 50px
203
+ left: auto
197
204
  padding: 8px
198
205
  z-index: $zindex-navbar-fixed - 10
199
206
  background-color: $gray-lighter
@@ -57,5 +57,27 @@
57
57
  &.full
58
58
  font-size: 0.9em
59
59
 
60
+ .input-group
61
+ +filter-style
62
+ .form-control
63
+ &:focus
64
+ +box-shadow(none)
65
+ .form-control,
66
+ .input-group-btn
67
+ background-color: transparent
68
+ border: none
69
+ +border-left-radius(20px)
70
+ .input-group-btn
71
+ overflow: hidden
72
+ +border-left-radius(0)
73
+ +border-right-radius(20px)
74
+ .btn
75
+ background-color: transparent
76
+ color: $gray
77
+ border-color: transparent
78
+ &:hover
79
+ color: $gray-dark
80
+
81
+
60
82
  .page-entries-info
61
83
  font-weight: 300
@@ -18,9 +18,8 @@
18
18
  +material-box-shadow-soft(3)
19
19
 
20
20
  .navmenu-brand
21
- // +background(linear-gradient(to top right, $brand-primary, $brand-info))
22
21
  background-color: $blue-darker
23
- color: white
22
+ color: #fff
24
23
  display: block
25
24
  font-size: 1.4em
26
25
  font-weight: 300
@@ -35,7 +34,6 @@
35
34
  color: white
36
35
 
37
36
  .navmenu-nav
38
- // background-color: $navbar-default-bg
39
37
  background-color: $gray-lighter
40
38
  height: calc(100% - 60px)
41
39
  width: $left-menu-width-open
@@ -51,8 +49,6 @@
51
49
  color: $gray
52
50
  &:hover,
53
51
  &:focus
54
- // background-color: $navbar-default-bg
55
- // color: white
56
52
  background-color: $gray
57
53
  color: $gray-lighter
58
54
 
@@ -64,8 +60,6 @@
64
60
  padding: 0
65
61
 
66
62
  .component-section-title
67
- // background-color: $navbar-default-bg
68
- // color: white
69
63
  background-color: $gray-lighter
70
64
  color: $text-color
71
65
  font-weight: bold
@@ -86,29 +80,26 @@
86
80
 
87
81
  .component-item
88
82
  a, button
89
- // background-color: $text-color
90
- // color: $gray-light
91
- color: $text-color
83
+ background-color: transparent
92
84
  display: block
93
85
  font-weight: 400
94
86
  line-height: 19px
87
+ color: $text-color
88
+ font-weight: 400
95
89
  padding: 11px 13px 11px 15px
96
90
  text-decoration: none
97
91
 
98
92
  +default-transition
99
93
  &:hover,
100
94
  &:focus
101
- // background-color: $navbar-default-bg
102
- background-color: $gray-lighter
103
95
  padding-left: 25px
96
+ background-color: $gray-lighter
104
97
 
105
98
  &.active
106
99
  a, button
107
- // background-color: lighten($navbar-default-bg, 10%)
108
- background-color: $gray-light
109
- border-color: $brand-primary
110
100
  border-left: 2px solid $brand-primary
111
- // color: white
101
+ background-color: $gray-light
102
+ color: $text-color
112
103
  padding-left: 25px
113
104
 
114
105
  //== Top navbar
@@ -148,3 +139,35 @@
148
139
  .navbar-toggle
149
140
  float: left
150
141
  display: block
142
+
143
+ //** Dark theme override
144
+ //***********************
145
+ .dark-theme.navmenu-default
146
+ .navmenu-brand
147
+ +background(linear-gradient(to top right, $brand-primary, $brand-info))
148
+ .navmenu-nav
149
+ background-color: $navbar-default-bg
150
+ > li > a
151
+ &:hover,
152
+ &:focus
153
+ background-color: $navbar-default-bg
154
+ color: white
155
+ .component-section-title
156
+ background-color: $navbar-default-bg
157
+ color: white
158
+ &:hover,
159
+ &:focus
160
+ background-color: transparent
161
+ color: white
162
+ .component-item
163
+ a, button
164
+ background-color: $text-color
165
+ color: $gray-lighter
166
+ &:hover,
167
+ &:focus
168
+ background-color: $navbar-default-bg
169
+ &.active
170
+ a, button
171
+ background-color: lighten($navbar-default-bg, 10%)
172
+ border-color: $brand-primary
173
+ color: white
@@ -49,18 +49,19 @@
49
49
  float: left
50
50
  padding: 10px
51
51
  text-align: center
52
- width: 33.333333%
52
+ width: 100%
53
53
 
54
54
  > a
55
55
  +border-radius(2px)
56
56
  +default-transition
57
- background: image_url('para/admin/template-section.svg') no-repeat center $gray-lighter
57
+ background: image_url('para/admin/template-section.svg') no-repeat $gray-lighter
58
+ background-position: center 10px
58
59
  border: 1px dashed $gray
59
60
  color: $gray
60
61
  display: block
61
62
  font-weight: bold
62
- height: 100%
63
- padding: 75px 5px
63
+ height: 115px
64
+ padding: 70px 5px 5px 5px
64
65
  text-transform: uppercase
65
66
  width: 100%
66
67
  white-space: normal
@@ -4,10 +4,18 @@
4
4
 
5
5
  //== Main style
6
6
  //
7
- //##
7
+ //## Label have to be like a legend if is the nested_one
8
8
 
9
9
  .form-group.nested_one
10
10
  label.control-label.nested_one
11
- font-weight: 700
12
- font-size: 18px
11
+ font-weight: 600
12
+ font-size: 21px
13
13
  color: $blue-darker
14
+ text-transform: inherit
15
+ margin-top: 15px
16
+ margin-bottom: 15px
17
+
18
+ .tab-pane
19
+ > .form-group.nested_one
20
+ label.control-label.nested_one
21
+ margin-top: 0
@@ -7,6 +7,20 @@
7
7
 
8
8
  /* Small devices (tablets, 768px and up) */
9
9
  @media (min-width: $screen-sm-min)
10
+ //== Fixed actions
11
+ //
12
+ //## See form.sass
13
+ .form-fixed-actions
14
+ .form-actions
15
+ .btn
16
+ margin-bottom: 0
17
+ margin-right: 5px
18
+
19
+ //== Nested many
20
+ //
21
+ //## See neste_many.sass
22
+ .nested-many-field.nested-many-field-inset .nested-many-inset-add-button.open > .dropdown-menu > li
23
+ width: 50%
10
24
 
11
25
  /* Medium devices (desktops, 992px and up) */
12
26
  @media (min-width: $screen-md-min)
@@ -32,19 +46,21 @@
32
46
  .loading-spinner
33
47
  margin-left: ($left-menu-width-open / 2) - ($spinner-size / 2)
34
48
 
35
- //== Fixed actions
49
+ //== Nested many
36
50
  //
37
- //## See form.sass
38
- .form-fixed-actions
39
- .form-actions
40
- // left: $left-menu-width-open + 50px
41
- .btn
42
- margin-bottom: 0
43
- margin-right: 5px
51
+ //## See neste_many.sass
52
+ .nested-many-field.nested-many-field-inset .nested-many-inset-add-button.open > .dropdown-menu > li
53
+ width: 33.333333%
44
54
 
45
55
  /* Large devices (large desktops, 1200px and up) */
46
56
  @media (min-width: $screen-lg-min)
47
-
57
+ //== Nested many
58
+ //
59
+ //## See neste_many.sass
60
+ .nested-many-field.nested-many-field-inset .nested-many-inset-add-button.open > .dropdown-menu > li > a
61
+ background-position: center center
62
+ padding: 75px 5px
63
+ height: 100%
48
64
 
49
65
  //== Max width
50
66
  //
@@ -83,6 +99,7 @@
83
99
  .form-actions
84
100
  padding-right: 15px
85
101
  padding-left: 15px
102
+ left: 50px
86
103
  .btn
87
104
  width: 100%
88
105
 
@@ -5,6 +5,7 @@ module Para
5
5
  as: :resource,
6
6
  wrapper: :vertical_form,
7
7
  wrapper_mappings: Para::SimpleFormConfig.wrapper_mappings,
8
+ track_attribute_mappings: true,
8
9
  html: { class: '', data: { :'para-form' => true } }
9
10
  }
10
11
 
@@ -12,14 +12,34 @@ module Para
12
12
  end
13
13
 
14
14
  class << self
15
+
16
+ # This method is a shortcut to create a has_one through relation
17
+ def section_resource(*args, &block)
18
+ _ensure_section_resource_relation
19
+ _create_section_resource_has_one_relation_for(*args, &block)
20
+ end
21
+
15
22
  # This method is a shortcut to create a has_many through relation
16
23
  def section_resources(*args, &block)
17
24
  _ensure_section_resources_relation
18
- _create_section_resource_relation_for(*args, &block)
25
+ _create_section_resource_has_many_relation_for(*args, &block)
19
26
  end
20
27
 
21
28
  private
22
29
 
30
+ def _ensure_section_resource_relation
31
+ return if @section_resource_already_initialized
32
+
33
+ has_one :section_resource, -> { ordered },
34
+ foreign_key: 'section_id',
35
+ class_name: '::Para::Page::SectionResource',
36
+ dependent: :destroy
37
+
38
+ accepts_nested_attributes_for :section_resource, allow_destroy: true
39
+
40
+ @section_resource_already_initialized = true
41
+ end
42
+
23
43
  def _ensure_section_resources_relation
24
44
  return if @section_resources_already_initialized
25
45
 
@@ -32,7 +52,27 @@ module Para
32
52
  @section_resources_already_initialized = true
33
53
  end
34
54
 
35
- def _create_section_resource_relation_for(*args, &block)
55
+ def _create_section_resource_has_one_relation_for(*args, &block)
56
+ options = args.extract_options!
57
+
58
+ # Allow using :class_name option instead of :source_type to feel more
59
+ # like a direct has_many relation macro, and try to deduce the target
60
+ # class name from the relation name.
61
+ target_class_name = options.fetch(:class_name) do
62
+ args.first.to_s.singularize.camelize
63
+ end
64
+
65
+ # Fill the through relation options but let the user override them
66
+ options.reverse_merge!(
67
+ through: :section_resource,
68
+ source: :resource,
69
+ source_type: target_class_name
70
+ )
71
+
72
+ has_one(*args, options, &block)
73
+ end
74
+
75
+ def _create_section_resource_has_many_relation_for(*args, &block)
36
76
  options = args.extract_options!
37
77
 
38
78
  # Allow using :class_name option instead of :source_type to feel more
@@ -1,4 +1,4 @@
1
- .navmenu.navmenu-default.navmenu-fixed-left.offcanvas-sm
1
+ .navmenu.navmenu-default.navmenu-fixed-left.offcanvas-sm{ class: ('dark-theme' if Para.config.dark_theme) }
2
2
  = link_to admin_path, class: 'navmenu-brand' do
3
3
  = t('para.admin.brand').html_safe
4
4
 
@@ -11,9 +11,28 @@ en:
11
11
  destroy:
12
12
  success: "%{model} deleted"
13
13
  error: "Could not delete %{model}"
14
+ clone:
15
+ success: "%{model} cloned"
16
+ error: "Could not clone %{model}"
17
+
18
+ jobs:
19
+ para/importer/base:
20
+ progressing: "The file is being imported, please wait a few moments ..."
21
+ success: "The import of the file was successfully completed"
22
+ success_with_errors: |
23
+ The import of the file was done, but some lines
24
+ were not taken into account due to errors :
25
+ other_errors: "<br>And <b>%{count}</b> others errors ..."
26
+ error: "The selected file contains errors and could not be imported"
27
+
28
+ para/exporter/base:
29
+ progressing: "The file is being exported, please wait a few moments ..."
30
+ success: "The export file was generated, its download will start ..."
31
+ error: "Error generating the export file ..."
14
32
 
15
33
  admin:
16
- title: "Admin"
34
+ title: Administration
35
+ brand: "<b>Admin</b>istration"
17
36
  toggle_navigation: "Open navigation"
18
37
  back_to_app: "Back to app"
19
38
  sign_out: "Sign out"
@@ -21,6 +40,9 @@ en:
21
40
  confirmation:
22
41
  shared:
23
42
  destroy: 'Are you sure that you want to delete %{model} ?'
43
+
44
+ component:
45
+ none_created: "No components yet ..."
24
46
 
25
47
  component:
26
48
  create: "Create a component"
@@ -33,6 +55,9 @@ en:
33
55
 
34
56
  dashboard:
35
57
  title: "Dashboard"
58
+ statcard:
59
+ ressources_count: "Number of entries : %{count}"
60
+ component_form_ressource: "See page"
36
61
 
37
62
  component_section:
38
63
  add: "Add a component section"
@@ -49,6 +74,16 @@ en:
49
74
  add: "Add"
50
75
  remove: "Remove"
51
76
  new: "New"
77
+ multi_select:
78
+ available:
79
+ title: "Available"
80
+ no_items: "Search for items with the search bar above"
81
+ add_all: "Add all"
82
+ already_selected: "Add"
83
+ selected:
84
+ title: "Add"
85
+ no_items: "Use the search form on the left to add items."
86
+ remove_all: "Remove all"
52
87
 
53
88
  list:
54
89
  search_title: "Search"
@@ -58,13 +93,17 @@ en:
58
93
 
59
94
  export:
60
95
  name: "Export %{name}"
61
- as: "Exporter (.%{extension})"
96
+ as: "Exporting (.%{extension})"
62
97
 
63
98
  import:
64
99
  name: Import
65
100
  select: "Select file"
66
101
  change: "Change file"
102
+ help_text: |
103
+ Select an Excel file (.xls, .xlsx) ou CSV (.csv) to import and
104
+ click the "Importing" button.
67
105
  placeholder: File format ( .csv .xlsx )
106
+ row_error_prefix: "Line %{number} :"
68
107
 
69
108
  shared:
70
109
  save: "Save"
@@ -73,6 +112,10 @@ en:
73
112
  search: "Search"
74
113
  save_and_edit: "Save and edit"
75
114
  save_and_add_another_button: "Save and create a other"
115
+ destroy: "Destroy"
116
+ edit: "Edit"
117
+ copy: "Duplicate"
118
+ close: "Close"
76
119
 
77
120
  types:
78
121
  boolean:
@@ -103,4 +146,24 @@ en:
103
146
  type: "Type"
104
147
  model_type: "Resource"
105
148
  namespaced: "Only list component's resources"
149
+
150
+ activemodel:
151
+ models:
152
+ settings_rails/form:
153
+ one: "Configuration"
154
+ other: "Configuration"
155
+ para/exporter/base:
156
+ one: "Export of data"
157
+ other: "Exports of data"
158
+
159
+ helpers:
160
+ page_entries_info:
161
+ number_per_page: Number of entries per page
162
+ one_page:
163
+ display_entries:
164
+ zero: "No entries found"
165
+ one: "Display of entries <b>1&nbsp;-&nbsp;1</b> to <b>1</b> in total"
166
+ other: "Display of entries <b>1&nbsp;-&nbsp;%{count}</b> to <b>%{count}</b> in total"
167
+ more_pages:
168
+ display_entries: "Display of entries <b>%{first}&nbsp;-&nbsp;%{last}</b> to <b>%{total}</b> in total"
106
169
 
@@ -14,15 +14,19 @@ module Para
14
14
 
15
15
  template(
16
16
  "#{ base_exporter_template_name_for(format) }_exporter.rb",
17
- "app/exporters/#{ plural_file_name }_exporter.rb"
17
+ "app/exporters/#{ exporter_name }.rb"
18
18
  )
19
19
  end
20
20
  end
21
21
 
22
22
  private
23
23
 
24
- def model_exporter_name
25
- Para::Exporter.model_exporter_name(class_name)
24
+ def exporter_class_name
25
+ exporter_name.camelize
26
+ end
27
+
28
+ def exporter_name
29
+ [plural_file_name, 'exporter'].join('_')
26
30
  end
27
31
 
28
32
  def base_exporter_template_name_for(format)
@@ -1,4 +1,4 @@
1
- class <%= model_exporter_name %> < Para::Exporter::Base
1
+ class <%= exporter_class_name %> < Para::Exporter::Base
2
2
  def name
3
3
  '<%= file_name %>'
4
4
  end
@@ -1,4 +1,4 @@
1
- class <%= model_exporter_name %> < Para::Exporter::Csv
1
+ class <%= exporter_class_name %> < Para::Exporter::Csv
2
2
  def name
3
3
  '<%= file_name %>'
4
4
  end
@@ -1,4 +1,4 @@
1
- class <%= model_exporter_name %> < Para::Exporter::Xls
1
+ class <%= exporter_class_name %> < Para::Exporter::Xls
2
2
  def name
3
3
  '<%= file_name %>'
4
4
  end
@@ -26,6 +26,10 @@ Para.config do |config|
26
26
  #
27
27
  # config.resource_name_methods += [:full_name]
28
28
 
29
+ # Configure the theme navigation bar color not gray but blue darker
30
+ #
31
+ # config.dark_theme = true
32
+
29
33
  # Set if the Para::Breadcrumb::Controller module should be included into the
30
34
  # app, allowing easy breadcrumbs management in the app.
31
35
  #
@@ -10,7 +10,7 @@ module Para
10
10
  end
11
11
 
12
12
  def wrapper_name
13
- :horizontal_form
13
+ :vertical_form
14
14
  end
15
15
  end
16
16
  end
@@ -19,7 +19,11 @@ module Para
19
19
  end
20
20
 
21
21
  def method_missing(method, *args, &block)
22
- component_for(method) || super
22
+ if (component = component_for(method))
23
+ component.tap(&ActiveDecorator::Decorator.instance.method(:decorate))
24
+ else
25
+ super
26
+ end
23
27
  end
24
28
 
25
29
  def section_for(identifier)
data/lib/para/config.rb CHANGED
@@ -39,6 +39,9 @@ module Para
39
39
  mattr_accessor :page_actions
40
40
  @@page_actions = {}
41
41
 
42
+ mattr_accessor :dark_theme
43
+ @@dark_theme = false
44
+
42
45
  # Allows changing default cache store used by Para to store jobs through
43
46
  # the ActiveJob::Status gem
44
47
  #
@@ -19,8 +19,11 @@ module Para
19
19
  super(attribute_name, options)
20
20
  end
21
21
 
22
- def fields_for(*args, options, &block)
23
- super(*args, options) do |fields|
22
+ def fields_for(*args, &block)
23
+ fields_options = args.extract_options!
24
+ fields_options.reverse_merge!(track_attribute_mappings: options[:track_attribute_mappings])
25
+
26
+ super(*args, fields_options) do |fields|
24
27
  fields_html = @template.capture { block.call(fields) }
25
28
 
26
29
  fields_html + fields.attributes_mappings_field_for(fields)
@@ -28,14 +31,18 @@ module Para
28
31
  end
29
32
 
30
33
  def attributes_mappings_field_for(fields)
34
+ return unless options[:track_attribute_mappings]
35
+
31
36
  hidden_field :_attributes_mappings, value: @attributes_mappings.to_json,
32
37
  data: { :'attributes-mappings' => fields.options[:child_index] }
33
38
  end
34
39
 
35
40
  private
36
41
 
37
- def store_attribute_mapping_for(attribute_name, options, &block)
38
- input = find_input(attribute_name, options, &block)
42
+ def store_attribute_mapping_for(attribute_name, input_options, &block)
43
+ return unless options[:track_attribute_mappings]
44
+
45
+ input = find_input(attribute_name, input_options, &block)
39
46
  type = input.class.name.demodulize.underscore.gsub(/_input\z/, '')
40
47
 
41
48
  @attributes_mappings[attribute_name] = type
@@ -51,6 +51,7 @@ module Para
51
51
 
52
52
  def dom_id
53
53
  @dom_id = [
54
+ 'form-tab',
54
55
  builder.nested_resource_dom_id.presence,
55
56
  identifier.to_s.parameterize
56
57
  ].compact.join('-')
data/lib/para/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Para
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails