brightcontent-core 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a59c7387cca9c17d2cdd1a2172f14732fac39181
4
- data.tar.gz: b35f502da97a126b6f1dd2d5553564bbcec67149
3
+ metadata.gz: 2c895a80f6aef94f097927e50b683a0d8e6bee74
4
+ data.tar.gz: 7151460efa15b166b6e215f350b33bdc4561c41b
5
5
  SHA512:
6
- metadata.gz: e51652e0b7c53f62e023f2c01fda8ddddf55d30e43feaa8ae2d29d710c703e3696deac162132dc18c7377762df3e6bcc46402d214a59edef3ec3698a054f7ca3
7
- data.tar.gz: b4fa46b6fc1c9331ad112831e0ed4c2a00182c537b940fc5df6de05f4f1b56dc5fb5f04293913a953d67bb0df61a28f673a01fca08dafc30c79dc3f467c90cc5
6
+ metadata.gz: 03f1a3566baf1f60c8b694c57a14310bd11e7f7bc1fc0b7a3abbfe2d6b50dddeabd62f0a48cdb3e1897f08aa99fb9c09b170a2db6003c322b3240537d9640198
7
+ data.tar.gz: f8ae058fb2c666e140b8149e842a757a30ea09233463a0f34ae6ce575877a69c77c4af5a9c8efc3592b564f8827311e6dcf82d11a4c546b15ea3b9b3b2b6b865
@@ -17,6 +17,6 @@ $(function() {
17
17
  }
18
18
  });
19
19
 
20
- $('[data-behaviour~=datepicker]').datetimepicker(pickTime: false, language: 'nl')
21
- $('[data-behaviour~=datetimepicker]').datetimepicker(language: 'nl')
20
+ $('[data-behaviour~=datepicker]').datetimepicker({ pickTime: false, language: 'nl' })
21
+ $('[data-behaviour~=datetimepicker]').datetimepicker({ language: 'nl' })
22
22
  });
@@ -7,7 +7,7 @@ module Brightcontent
7
7
 
8
8
  included do
9
9
  before_action :set_collection
10
- before_action :set_resource, only: [:show, :edit, :update, :destroy]
10
+ before_action :set_resource
11
11
  helper_method :resource, :resource_class, :resource_index_path, :resource_path, :collection, :resource_edit_path
12
12
  end
13
13
 
@@ -36,11 +36,15 @@ module Brightcontent
36
36
  end
37
37
 
38
38
  def resource_name
39
- controller_name
39
+ resource_class.model_name.plural
40
40
  end
41
41
 
42
42
  def resource_instance_name
43
- resource_name.singularize
43
+ resource_class.model_name.singular
44
+ end
45
+
46
+ def resource_human_name(options = {})
47
+ resource_class.model_name.human(options)
44
48
  end
45
49
 
46
50
  def index
@@ -60,7 +64,7 @@ module Brightcontent
60
64
  def create
61
65
  self.resource = base_collection.new(resource_params)
62
66
  if resource.save
63
- redirect_to resource_redirect_path, notice: t("flash.actions.create.notice", resource_name: resource_instance_name.capitalize)
67
+ redirect_to resource_redirect_path, notice: t("flash.actions.create.notice", resource_name: resource_human_name)
64
68
  else
65
69
  render :new
66
70
  end
@@ -68,7 +72,7 @@ module Brightcontent
68
72
 
69
73
  def update
70
74
  if resource.update(resource_params)
71
- redirect_to resource_redirect_path, notice: t("flash.actions.update.notice", resource_name: resource_instance_name.capitalize)
75
+ redirect_to resource_redirect_path, notice: t("flash.actions.update.notice", resource_name: resource_human_name)
72
76
  else
73
77
  render :edit
74
78
  end
@@ -76,9 +80,9 @@ module Brightcontent
76
80
 
77
81
  def destroy
78
82
  if resource.destroy
79
- redirect_to resource_index_path, notice: t("flash.actions.destroy.notice", resource_name: resource_instance_name.capitalize)
83
+ redirect_to resource_index_path, notice: t("flash.actions.destroy.notice", resource_name: resource_human_name)
80
84
  else
81
- redirect_to resource_index_path, alert: t("flash.actions.destroy.alert", resource_name: resource_instance_name.capitalize)
85
+ redirect_to resource_index_path, alert: t("flash.actions.destroy.alert", resource_name: resource_human_name)
82
86
  end
83
87
  end
84
88
 
@@ -89,7 +93,7 @@ module Brightcontent
89
93
  end
90
94
 
91
95
  def set_resource
92
- self.resource = base_collection.find(params[:id])
96
+ self.resource = base_collection.find(params[:id]) if params[:id].present?
93
97
  end
94
98
 
95
99
  def resource_params
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Developers at Brightin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-08 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails