udongo 5.0.2 → 5.1.0

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: 7ebf3adfc859ce7df9af8b0770945c03f7cdc337
4
- data.tar.gz: 0576147999f321b1f1cd668284b9605cac051140
3
+ metadata.gz: 6e7758e4a1bfb4e24e8b4ff54ba00225802be713
4
+ data.tar.gz: 2c45f1de07eac96c9127c5bfb0c338bec8754f51
5
5
  SHA512:
6
- metadata.gz: 702c4a17ba9be8b39410d1aabc96ccad973f6d538dd2d22297b47cfd700f1041c823aed750b548ce7f788ae08898fa8976b5a829d5459c2010ab48e727ed9d67
7
- data.tar.gz: 8abd987fea228857b348267e8d88927e10835000b6d6da3cf3f441b5e59b0f1a39a175bebdebffb25095096974613b71fc7debd3ba37878bffcba3328d280bd7
6
+ metadata.gz: 3f2a7cbd3e48e5a773ed2bfe24ccbcc0eeb10ae6570b32bea19381875e30ebb710bbd4761cd6063aeee7ff41912dc52923a057ea6986f33ae48dff0771985d59
7
+ data.tar.gz: 7291bf66476a79eba40459c33e5234ed20679f9c37177d0f1e6ed22ad061edce684c3730b7f2a396f7008037b676a0af08d616394023edf69fd0729d65487781
@@ -11,6 +11,11 @@
11
11
  margin-bottom: 2rem;
12
12
  }
13
13
 
14
+ // To make sure collections rendered by SimpleForm show on multiple lines.
15
+ label.collection_check_boxes {
16
+ display: block;
17
+ }
18
+
14
19
  // Underscored because of SimpleForm
15
20
  .date_picker, .date_range_picker {
16
21
  [readonly="readonly"] {
@@ -0,0 +1,3 @@
1
+ td.handle {
2
+ width: 50px;
3
+ }
@@ -11,6 +11,7 @@
11
11
  @import 'components/form';
12
12
  @import 'components/nav';
13
13
  @import 'components/page_tree';
14
+ @import 'components/table';
14
15
 
15
16
  // Page specific styles
16
17
  @import 'pages/login';
@@ -4,7 +4,7 @@ class Backend::EmailsController < Backend::BaseController
4
4
  before_action -> { breadcrumb.add t('b.emails'), backend_emails_path }
5
5
 
6
6
  def index
7
- @emails = paginate Email.all.order('id DESC')
7
+ @emails = paginate Email.order('id DESC')
8
8
  end
9
9
 
10
10
  def show
@@ -1,9 +1,12 @@
1
1
  class Backend::UsersController < Backend::BaseController
2
- before_action :find_user, only: [:show, :edit, :update, :destroy]
2
+ include Concerns::PaginationController
3
+
4
+ before_action :find_model, only: [:show, :edit, :update, :destroy]
3
5
  before_action -> { breadcrumb.add t('b.users'), backend_users_path }
4
6
 
5
7
  def index
6
- @users = User.all
8
+ @search = User.ransack params[:q]
9
+ @users = @search.result(distinct: true).order(:last_name, :first_name).page(page_number).per_page(per_page)
7
10
  end
8
11
 
9
12
  def show
@@ -39,13 +42,13 @@ class Backend::UsersController < Backend::BaseController
39
42
 
40
43
  private
41
44
 
42
- def find_user
45
+ def find_model
43
46
  @user = User.find params[:id]
44
47
  end
45
48
 
46
49
  def allowed_params
47
50
  params[:user].permit(
48
- :first_name, :last_name, :email, :password, :password_confirmation
51
+ :first_name, :last_name, :email, :active, :password, :password_confirmation
49
52
  )
50
53
  end
51
54
  end
@@ -32,7 +32,7 @@ module Concerns
32
32
  return i if params[:per_page].to_i == i
33
33
  end
34
34
 
35
- 30
35
+ 10
36
36
  end
37
37
  end
38
38
  end
@@ -1,68 +1,10 @@
1
- class Backend::PageTranslationForm < Udongo::Form
2
- attr_reader :page, :translation, :seo
3
-
1
+ class Backend::PageTranslationForm < Backend::TranslationWithSeoForm
4
2
  attribute :title, String
5
3
  attribute :subtitle, String
6
4
 
7
- attribute :seo_title, String
8
- attribute :seo_keywords, String
9
- attribute :seo_description, String
10
- attribute :seo_custom, String
11
- attribute :seo_slug, String
12
-
13
- validates :title, :seo_slug, presence: true
14
-
15
- delegate :id, to: :page
16
-
17
- def initialize(page, translation, seo)
18
- @page = page
19
- @translation = translation
20
- @seo = seo
21
-
22
- self.title = @translation.title
23
- self.subtitle = @translation.subtitle
24
-
25
- %w(title keywords description custom slug).each do |f|
26
- self.send("seo_#{f}=", @seo.send(f))
27
- end
28
- end
5
+ validates :title, presence: true
29
6
 
30
7
  def self.model_name
31
8
  Page.model_name
32
9
  end
33
-
34
- def persisted?
35
- true
36
- end
37
-
38
- def save(params)
39
- self.title = params[:title]
40
- self.subtitle = params[:subtitle]
41
-
42
- %w(title keywords description custom slug).each do |f|
43
- self.send("seo_#{f}=", params["seo_#{f}".to_sym])
44
- end
45
-
46
- if valid?
47
- save_object
48
- true
49
- else
50
- false
51
- end
52
- end
53
-
54
- private
55
-
56
- def save_object
57
- @translation.title = title
58
- @translation.subtitle = subtitle
59
-
60
- %w(title keywords description custom slug).each do |f|
61
- @seo.send("#{f}=", send("seo_#{f}"))
62
- end
63
-
64
- # Saves the page, translation and SEO info all at once.
65
- @seo.save!
66
- @page.save!
67
- end
68
10
  end
@@ -0,0 +1,71 @@
1
+ class Backend::TranslationWithSeoForm < Udongo::Form
2
+ attr_reader :model, :translation, :seo
3
+ delegate :id, to: :model
4
+
5
+ attribute :seo_title, String
6
+ attribute :seo_keywords, String
7
+ attribute :seo_description, String
8
+ attribute :seo_custom, String
9
+ attribute :seo_slug, String
10
+
11
+ validates :seo_slug, presence: true
12
+
13
+ def initialize(model, translation, seo)
14
+ @model = model
15
+ @translation = translation
16
+ @seo = seo
17
+
18
+ non_seo_attributes.each do |f|
19
+ self.send "#{f}=", @translation.send(f)
20
+ end
21
+
22
+ seo_attributes.each do |f|
23
+ self.send("seo_#{f}=", @seo.send(f))
24
+ end
25
+ end
26
+
27
+ def persisted?
28
+ true
29
+ end
30
+
31
+ def save(params)
32
+ non_seo_attributes.each do |f|
33
+ self.send "#{f}=", params[f.to_sym]
34
+ end
35
+
36
+ seo_attributes.each do |f|
37
+ self.send("seo_#{f}=", params["seo_#{f}".to_sym])
38
+ end
39
+
40
+ if valid?
41
+ save_object
42
+ true
43
+ else
44
+ false
45
+ end
46
+ end
47
+
48
+ def seo_attributes
49
+ %w(title keywords description custom slug)
50
+ end
51
+
52
+ def non_seo_attributes
53
+ attributes.keys.select { |k| !k.to_s.starts_with?('seo_') }
54
+ end
55
+
56
+ private
57
+
58
+ def save_object
59
+ non_seo_attributes.each do |f|
60
+ @translation.send "#{f}=", self.send(f)
61
+ end
62
+
63
+ seo_attributes.each do |f|
64
+ @seo.send("#{f}=", send("seo_#{f}"))
65
+ end
66
+
67
+ # Saves the model, translation and SEO info all at once.
68
+ @seo.save!
69
+ @model.save!
70
+ end
71
+ end
@@ -0,0 +1,25 @@
1
+ <div class="card filter">
2
+ <div class="card-block">
3
+ <%= search_form_for [:backend, @search] do |f| %>
4
+ <div class="row">
5
+ <div class="col-md-4 form-group">
6
+ <%= f.search_field :first_name_cont, placeholder: t('b.first_name'), class: 'form-control' %>
7
+ </div>
8
+
9
+ <div class="col-md-4 form-group">
10
+ <%= f.search_field :last_name_cont, placeholder: t('b.last_name'), class: 'form-control' %>
11
+ </div>
12
+
13
+ <div class="col-md-4 form-group">
14
+ <%= f.search_field :email_cont, placeholder: t('b.email'), class: 'form-control' %>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="row">
19
+ <div class="col-md-6">
20
+ <%= f.submit class: 'btn btn-primary btn-sm' %>
21
+ </div>
22
+ </div>
23
+ <% end %>
24
+ </div>
25
+ </div>
@@ -25,6 +25,7 @@
25
25
  <div class="card-block">
26
26
  <%= f.input :password, required: @user.new_record? %>
27
27
  <%= f.input :password_confirmation, required: @user.new_record? %>
28
+ <%= f.input :active %>
28
29
  </div>
29
30
  </div>
30
31
  </div>
@@ -1,4 +1,5 @@
1
1
  <%= render 'backend/breadcrumbs' %>
2
+ <%= render 'filter' %>
2
3
 
3
4
  <p class="text-xs-right">
4
5
  <%= link_to icon(:plus, t('b.add')), new_backend_user_path, class: 'btn btn-primary btn-sm' %>
@@ -10,24 +11,28 @@
10
11
  <tr>
11
12
  <th><%= t 'b.name' %></th>
12
13
  <th><%= t 'b.email' %></th>
14
+ <th><%= t 'b.active' %></th>
13
15
  <th>&nbsp;</th>
14
16
  </tr>
15
17
  </thead>
16
18
 
17
19
  <tbody>
18
- <% @users.each do |a| %>
19
- <tr>
20
- <td><%= a.full_name %></td>
21
- <td><%= mail_to a.email %></td>
20
+ <% @users.each do |u| %>
21
+ <tr class="<%= 'text-muted' unless u.active? %>">
22
+ <td><%= u.full_name %></td>
23
+ <td><%= mail_to u.email %></td>
24
+ <td><%= t u.active?.to_s %></td>
22
25
  <td class="text-xs-right">
23
- <%= link_to icon(:pencil_square_o), edit_backend_user_path(a) %>
24
- <%= link_to icon(:trash), backend_user_path(a), method: :delete, data: { confirm: t('b.msg.confirm') }%>
26
+ <%= link_to icon(:pencil_square_o), edit_backend_user_path(u) %>
27
+ <%= link_to icon(:trash), backend_user_path(u), method: :delete, data: {confirm: t('b.msg.confirm') }%>
25
28
  </td>
26
29
  </tr>
27
30
  <% end %>
28
31
  </tbody>
29
32
  </table>
30
33
 
34
+ <%= udongo_paginate @users %>
35
+
31
36
  <% else %>
32
37
  <p><%= t 'b.msg.no_items' %></p>
33
38
  <% end %>
data/changelog.md CHANGED
@@ -1,4 +1,17 @@
1
- 5.0.2 - xxxx-xx-xx
1
+ 5.1.0 - 2017-02-15
2
+ --
3
+ * The users module now orders by last/first name.
4
+ * The default number of items per page is now 10 instead of 30.
5
+ * A user now has an active/inactive state that you can manage.
6
+ * You can now filter users by their first name, last name and email address.
7
+ * Next to the ```Backend::TranslationForm``` we now added the ```Backend::TranslationWithSeoForm```
8
+ which makes those forms great again.
9
+ * Add fix for a collection of checkboxes rendered by SimpleForm to show on
10
+ multiple lines.
11
+ * Set a max width for the cell containing the sortable handle.
12
+
13
+
14
+ 5.0.2 - 2017-02-13
2
15
  --
3
16
  * Fix bug in the SEO form of b/pages#edit_translation that prevented you from
4
17
  saving SEO data.
@@ -1,6 +1,7 @@
1
1
  nl:
2
2
  b:
3
3
  actions: Acties
4
+ active: Actief
4
5
  add: Toevoegen
5
6
  admin: Beheerder
6
7
  admins: Beheerders
@@ -13,6 +13,7 @@ nl:
13
13
 
14
14
  labels:
15
15
  defaults:
16
+ active: Actief
16
17
  bcc: BCC
17
18
  caption: Beschrijving
18
19
  category: Categorie
@@ -0,0 +1,6 @@
1
+ class AddActiveToUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :users, :active, :boolean, after: 'email'
4
+ add_index :users, :active
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '5.0.2'
2
+ VERSION = '5.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davy Hellemans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-13 00:00:00.000000000 Z
12
+ date: 2017-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -442,6 +442,7 @@ files:
442
442
  - app/assets/stylesheets/backend/components/_nav.scss
443
443
  - app/assets/stylesheets/backend/components/_navbar.scss
444
444
  - app/assets/stylesheets/backend/components/_page_tree.scss
445
+ - app/assets/stylesheets/backend/components/_table.scss
445
446
  - app/assets/stylesheets/backend/components/_tabs.scss
446
447
  - app/assets/stylesheets/backend/custom.scss
447
448
  - app/assets/stylesheets/backend/font-awesome.scss
@@ -490,6 +491,7 @@ files:
490
491
  - app/forms/backend/page_translation_form.rb
491
492
  - app/forms/backend/snippet_translation_form.rb
492
493
  - app/forms/backend/translation_form.rb
494
+ - app/forms/backend/translation_with_seo_form.rb
493
495
  - app/helpers/backend/dropdown_helper.rb
494
496
  - app/helpers/backend/pagination_helper.rb
495
497
  - app/helpers/icon_helper.rb
@@ -617,6 +619,7 @@ files:
617
619
  - app/views/backend/snippets/edit_translation.html.erb
618
620
  - app/views/backend/snippets/index.html.erb
619
621
  - app/views/backend/snippets/new.html.erb
622
+ - app/views/backend/users/_filter.html.erb
620
623
  - app/views/backend/users/_form.html.erb
621
624
  - app/views/backend/users/_tabs.html.erb
622
625
  - app/views/backend/users/edit.html.erb
@@ -718,6 +721,7 @@ files:
718
721
  - db/migrate/20170118153840_create_search_modules.rb
719
722
  - db/migrate/20170202170310_rename_key_to_name_for_search_indices.rb
720
723
  - db/migrate/20170212150903_cleanup_user_model.rb
724
+ - db/migrate/20170215132531_add_active_to_users.rb
721
725
  - lib/tasks/task_extras.rb
722
726
  - lib/tasks/udongo_tasks.rake
723
727
  - lib/udongo.rb