udongo 4.0.0 → 5.0.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: 3c5f900d7751fde5b3875bd0efe6ee7f56bf5488
4
- data.tar.gz: 347e24cfe05e569e89178a2b3f4fae33325c933f
3
+ metadata.gz: 03ec6deb38ed000dbcd57727c0f667c3badc1532
4
+ data.tar.gz: f4570b7da82b646770b7c28b95dafdd0267385aa
5
5
  SHA512:
6
- metadata.gz: 849fbe000dd4bd06f352fed26e8ff1f2a5931f19a97ef08b0933ed11171d337c7bde6302ecc012e8863441b547a81a62c539f5ee579cc9044043862dd968a4c3
7
- data.tar.gz: a73bbcad8f96b51c87a36788cb97b7e432d60be6e26924ed4d5389064a3676050be52b6c795786f55f229f7f61634ab4919b4254f6862a7369ae2c69296e856b
6
+ metadata.gz: 0978896a59861c96ccb94c1da31bfbc340e3110101afaab52059f5b57d675b40bebf675d3ecbe7e346eb197a98cf24eb4aeed44ed4991682691b0d049be52104
7
+ data.tar.gz: d87798eba170892b8cc7c1c5f538ab93a4497c4f6dce964fe6fe7caaf2a5b11df251bdb8953f9fbf8108ed75589d8466b5691a53bbbfd697d466fb12ae15305d
@@ -0,0 +1,11 @@
1
+ class Backend::Users::BaseController < Backend::BaseController
2
+ before_action :find_user
3
+ before_action do
4
+ breadcrumb.add t('b.users'), backend_users_path
5
+ breadcrumb.add @user.full_name
6
+ end
7
+
8
+ def find_user
9
+ @user = User.find params[:user_id]
10
+ end
11
+ end
@@ -0,0 +1,51 @@
1
+ class Backend::UsersController < Backend::BaseController
2
+ before_action :find_user, only: [:show, :edit, :update, :destroy]
3
+ before_action -> { breadcrumb.add t('b.users'), backend_users_path }
4
+
5
+ def index
6
+ @users = User.all
7
+ end
8
+
9
+ def show
10
+ redirect_to edit_backend_user_path(@user)
11
+ end
12
+
13
+ def new
14
+ @user = User.new
15
+ end
16
+
17
+ def create
18
+ @user = User.new allowed_params
19
+
20
+ if @user.save
21
+ redirect_to backend_users_path, notice: translate_notice(:added, :user)
22
+ else
23
+ render :new
24
+ end
25
+ end
26
+
27
+ def update
28
+ if @user.update_attributes allowed_params
29
+ redirect_to backend_users_path, notice: translate_notice(:changes_saved)
30
+ else
31
+ render :edit
32
+ end
33
+ end
34
+
35
+ def destroy
36
+ @user.destroy
37
+ redirect_to backend_users_path, notice: translate_notice(:deleted, :user)
38
+ end
39
+
40
+ private
41
+
42
+ def find_user
43
+ @user = User.find params[:id]
44
+ end
45
+
46
+ def allowed_params
47
+ params[:user].permit(
48
+ :first_name, :last_name, :email, :password, :password_confirmation
49
+ )
50
+ end
51
+ end
@@ -0,0 +1,10 @@
1
+ class User < ActiveRecord::Base
2
+ include Concerns::Person
3
+ has_secure_password
4
+
5
+ validates :first_name, :last_name, presence: true
6
+ validates :email,
7
+ presence: true,
8
+ email: true,
9
+ uniqueness: { case_sensitive: false }
10
+ end
@@ -20,8 +20,8 @@
20
20
  <td><%= a.full_name %></td>
21
21
  <td><%= mail_to a.email %></td>
22
22
  <td class="text-xs-right">
23
- <%= link_to icon(:pencil_square_o), edit_backend_admin_path(a) %>
24
- <%= link_to icon(:trash), backend_admin_path(a), method: :delete, data: { confirm: t('b.msg.confirm') }%>
23
+ <%= link_to_edit [:backend, a] %>
24
+ <%= link_to_delete [:backend, a] %>
25
25
  </td>
26
26
  </tr>
27
27
  <% end %>
@@ -28,8 +28,8 @@
28
28
  <td><%= t r.enabled?.to_s %></td>
29
29
  <td><%= r.times_used.to_i %></td>
30
30
  <td class="text-xs-right">
31
- <%= link_to icon(:pencil_square_o), edit_backend_redirect_path(r) %>
32
- <%= link_to icon(:trash), backend_redirect_path(r), method: 'delete', data: { confirm: t('b.msg.confirm') } %>
31
+ <%= link_to_edit [:backend, r] %>
32
+ <%= link_to_delete [:backend, r] %>
33
33
  </td>
34
34
  </tr>
35
35
  <% end %>
@@ -22,8 +22,8 @@
22
22
  <td><%= s.term %></td>
23
23
  <td><%= s.synonyms %></td>
24
24
  <td class="text-xs-right">
25
- <%= link_to icon(:pencil_square_o), edit_backend_search_synonym_path(s) %>
26
- <%= link_to icon(:trash), backend_search_synonym_path(s), method: 'delete', data: { confirm: t('b.msg.confirm') } %>
25
+ <%= link_to_edit [:backend, s] %>
26
+ <%= link_to_delete [:backend, s] %>
27
27
  </td>
28
28
  </tr>
29
29
  <% end %>
@@ -0,0 +1,34 @@
1
+ <%= render 'backend/general_form_error', object: @user %>
2
+
3
+ <%= simple_form_for [:backend, @user] do |f| %>
4
+ <div class="row">
5
+ <div class="col-md-6">
6
+ <div class="card">
7
+ <div class="card-header">
8
+ <%= t 'b.msg.users.personal_details' %>
9
+ </div>
10
+
11
+ <div class="card-block">
12
+ <%= f.input :first_name %>
13
+ <%= f.input :last_name %>
14
+ <%= f.input :email, required: true %>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="col-md-6">
20
+ <div class="card">
21
+ <div class="card-header">
22
+ <%= t 'b.msg.users.account_details' %>
23
+ </div>
24
+
25
+ <div class="card-block">
26
+ <%= f.input :password, required: @user.new_record? %>
27
+ <%= f.input :password_confirmation, required: @user.new_record? %>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <%= render 'backend/form_actions', cancel_url: backend_users_path %>
34
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <div class="row subnav">
2
+ <div class="col-md-12">
3
+ <ul class="nav nav-pills">
4
+ <li class="nav-item">
5
+ <% klass = %w(nav-link) %>
6
+ <% klass << 'active' if active == :general %>
7
+
8
+ <%= link_to t('b.general'), edit_backend_user_path(@user), class: klass %>
9
+ </li>
10
+
11
+ <!-- Add extra subnav links here -->
12
+ <!--
13
+ <li class="nav-item">
14
+ <% klass = %w(nav-link) %>
15
+ <% klass << 'active' if active == :foo %>
16
+
17
+ <%= link_to t('b.general'), '#', class: klass %>
18
+ </li>
19
+ -->
20
+ </ul>
21
+ </div>
22
+ </div>
@@ -0,0 +1,5 @@
1
+ <% breadcrumb.add @user.full_name, backend_user_path(@user) %>
2
+ <% breadcrumb.add t('b.edit') %>
3
+ <%= render 'backend/breadcrumbs' %>
4
+ <%= render 'backend/users/tabs', active: :general %>
5
+ <%= render 'backend/users/form' %>
@@ -0,0 +1,33 @@
1
+ <%= render 'backend/breadcrumbs' %>
2
+
3
+ <p class="text-xs-right">
4
+ <%= link_to icon(:plus, t('b.add')), new_backend_user_path, class: 'btn btn-primary btn-sm' %>
5
+ </p>
6
+
7
+ <% if @users.any? %>
8
+ <table class="table table-hover table-striped">
9
+ <thead class="thead-inverse">
10
+ <tr>
11
+ <th><%= t 'b.name' %></th>
12
+ <th><%= t 'b.email' %></th>
13
+ <th>&nbsp;</th>
14
+ </tr>
15
+ </thead>
16
+
17
+ <tbody>
18
+ <% @users.each do |a| %>
19
+ <tr>
20
+ <td><%= a.full_name %></td>
21
+ <td><%= mail_to a.email %></td>
22
+ <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') }%>
25
+ </td>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
30
+
31
+ <% else %>
32
+ <p><%= t 'b.msg.no_items' %></p>
33
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <% breadcrumb.add t('b.add') %>
2
+ <%= render 'backend/breadcrumbs' %>
3
+
4
+ <%= render 'form' %>
@@ -12,6 +12,7 @@
12
12
  <div class="dropdown-menu">
13
13
  <%= link_to t('b.navigation'), backend_navigations_path, class: 'dropdown-item' %>
14
14
  <%= link_to t('b.admins'), backend_admins_path, class: 'dropdown-item' %>
15
+ <%= link_to t('b.users'), backend_users_path, class: 'dropdown-item' %>
15
16
  <%= link_to t('b.redirects'), backend_redirects_path, class: 'dropdown-item' %>
16
17
  <div class="dropdown-divider"></div>
17
18
  <%= link_to t('b.emails'), backend_emails_path, class: 'dropdown-item' %>
@@ -1,3 +1,8 @@
1
+ 5.0.0 - 2017-02-12
2
+ --
3
+ * Added a general ```User``` model which you can extend in your own app.
4
+
5
+
1
6
  4.0.0 - 2017-02-12
2
7
  --
3
8
  * Added Concerns::Searchable. This lets model instances automatically save
@@ -67,6 +67,8 @@ en:
67
67
  to: To
68
68
  up: Up
69
69
  used: Used
70
+ user: User
71
+ users: Users
70
72
  variables: Variables
71
73
  view: View
72
74
 
@@ -99,9 +101,14 @@ en:
99
101
  navigation:
100
102
  custom: Custom
101
103
  no_items: There are no items.
104
+ pages:
105
+ invisible: Deze pagina is niet zichtbaar op de website.
102
106
  saved: '%s was saved.'
103
107
  seo: SEO
104
108
  status_codes:
105
109
  '301': 301 (Moved Permanently)
106
110
  '303': 303 (See Other)
107
111
  '307': 307 (Temporary Redirect)
112
+ users:
113
+ account_details: Account details
114
+ personal_details: Personal details
@@ -67,6 +67,8 @@ nl:
67
67
  to: Naar
68
68
  up: Omhoog
69
69
  used: Gebruikt
70
+ user: Gebruiker
71
+ users: Gebruikers
70
72
  variables: Variabelen
71
73
  view: Bekijk
72
74
 
@@ -107,3 +109,6 @@ nl:
107
109
  '301': 301 (Moved Permanently)
108
110
  '303': 303 (See Other)
109
111
  '307': 307 (Temporary Redirect)
112
+ users:
113
+ account_details: Accountgegevens
114
+ personal_details: Persoonlijke gegevens
@@ -16,9 +16,11 @@ Rails.application.routes.draw do
16
16
  get '/' => 'dashboard#show'
17
17
  get 'search' => 'search#query'
18
18
 
19
-
20
19
  resources :sessions, only: [:new, :create, :destroy]
21
20
  resources :admins
21
+ resources :users
22
+ resources :redirects, except: :show
23
+ resources :search_synonyms, except: :show
22
24
 
23
25
  resources :pages, except: [:show] do
24
26
  concerns :translatable
@@ -57,10 +59,6 @@ Rails.application.routes.draw do
57
59
  end
58
60
  end
59
61
 
60
- resources :redirects, except: :show
61
-
62
- resources :search_synonyms, except: :show
63
-
64
62
  namespace :content do
65
63
  resources :rows, only: [:index, :new, :destroy] do
66
64
  concerns :positionable
@@ -0,0 +1,11 @@
1
+ class CreateUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :email, index: true
5
+ t.string :password
6
+ t.string :password_digest
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class AddFirstLastAndDisplayNameToUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :users, :first_name, :string
4
+ add_column :users, :last_name, :string
5
+ add_column :users, :display_name, :string
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ class CleanupUserModel < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :users, :password
4
+ remove_column :users, :display_name
5
+
6
+ change_column :users, :first_name, :string, after: 'id'
7
+ change_column :users, :last_name, :string, after: 'first_name'
8
+ change_column :users, :email, :string, after: 'last_name'
9
+
10
+ add_column :users, :login_count, :integer, after: 'email'
11
+ add_column :users, :current_login_ip, :string, after: 'login_count'
12
+ add_column :users, :last_login_ip, :string, after: 'current_login_ip'
13
+ add_column :users, :current_login_at, :datetime, after: 'last_login_ip'
14
+ add_column :users, :last_login_at, :datetime, after: 'current_login_at'
15
+ add_column :users, :reset_password_token, :string, after: 'last_login_at'
16
+ add_column :users, :reset_password_sent_at, :datetime, after: 'reset_password_token'
17
+
18
+ add_index :users, :reset_password_token
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '4.0.0'
2
+ VERSION = '5.0.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: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davy Hellemans
@@ -468,6 +468,8 @@ files:
468
468
  - app/controllers/backend/sessions_controller.rb
469
469
  - app/controllers/backend/snippets_controller.rb
470
470
  - app/controllers/backend/tagbox_controller.rb
471
+ - app/controllers/backend/users/base_controller.rb
472
+ - app/controllers/backend/users_controller.rb
471
473
  - app/controllers/catch_all_controller.rb
472
474
  - app/controllers/concerns/backend/content_type_controller.rb
473
475
  - app/controllers/concerns/backend/positionable_controller.rb
@@ -552,6 +554,7 @@ files:
552
554
  - app/models/store_with_file.rb
553
555
  - app/models/tag.rb
554
556
  - app/models/tagged_item.rb
557
+ - app/models/user.rb
555
558
  - app/uploaders/ckeditor_attachment_file_uploader.rb
556
559
  - app/uploaders/ckeditor_picture_uploader.rb
557
560
  - app/uploaders/content_image_uploader.rb
@@ -614,6 +617,11 @@ files:
614
617
  - app/views/backend/snippets/edit_translation.html.erb
615
618
  - app/views/backend/snippets/index.html.erb
616
619
  - app/views/backend/snippets/new.html.erb
620
+ - app/views/backend/users/_form.html.erb
621
+ - app/views/backend/users/_tabs.html.erb
622
+ - app/views/backend/users/edit.html.erb
623
+ - app/views/backend/users/index.html.erb
624
+ - app/views/backend/users/new.html.erb
617
625
  - app/views/layouts/backend/_top_navigation.html.erb
618
626
  - app/views/layouts/backend/application.html.erb
619
627
  - app/views/layouts/backend/lightbox.html.erb
@@ -702,11 +710,14 @@ files:
702
710
  - db/migrate/20161029124558_add_locale_to_admin.rb
703
711
  - db/migrate/20161029130557_add_bcc_and_cc_to_email_templates.rb
704
712
  - db/migrate/20161029171056_add_ccc_and_bcc_to_email.rb
713
+ - db/migrate/20161201102429_create_users.rb
714
+ - db/migrate/20161201104929_add_first_last_and_display_name_to_users.rb
705
715
  - db/migrate/20170112151235_create_search_indices.rb
706
716
  - db/migrate/20170117143805_add_indices_to_search_indices.rb
707
717
  - db/migrate/20170118130428_create_search_synonyms.rb
708
718
  - db/migrate/20170118153840_create_search_modules.rb
709
719
  - db/migrate/20170202170310_rename_key_to_name_for_search_indices.rb
720
+ - db/migrate/20170212150903_cleanup_user_model.rb
710
721
  - lib/tasks/task_extras.rb
711
722
  - lib/tasks/udongo_tasks.rake
712
723
  - lib/udongo.rb