cosme 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/cosme.coffee +12 -3
- data/lib/cosme/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7a610c759d9d797f0bb69bd8d6629183d08d66
|
4
|
+
data.tar.gz: 7f8268a39d7aac18ccbb8387664951038ecd90d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64acb2546062d004366560152851adb4cf402889c6e6a934e4af4abcc2452f8ac5b80c8af7227c17d9a30b45dbb4ef281a3ab1acb637816088085c97ccc9565e
|
7
|
+
data.tar.gz: d57e6b8566c2bcc4f37f28d7bd6adc4e499488d837224c9fc4a648ef006813307f4d8012823a70a71dc18b72829b4095a96c037a821654b49a16783db387c3e2
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Create a cosmetic file into `app/cosmetics`, and call `Cosme#define` method in t
|
|
33
33
|
|
34
34
|
* `:controller` - Controller path. eg: 'admin/users' when called in Admin::UsersController. if you not set this option, apply a cosmetic in all controllers.
|
35
35
|
|
36
|
-
* `:action` - Action name. eg: 'index' when called in
|
36
|
+
* `:action` - Action name. eg: 'index' when called in \*Controller#index. if you not set this option, apply a cosmetic in all actions.
|
37
37
|
|
38
38
|
* `:target` - String of [jQuery Selectors](https://api.jquery.com/category/selectors/).
|
39
39
|
|
@@ -11,11 +11,11 @@ class Cosme
|
|
11
11
|
|
12
12
|
create: ($cosmetic) ->
|
13
13
|
content = $cosmetic.data('content')
|
14
|
-
return
|
14
|
+
return @warning('"data-content" is empty.', $cosmetic) if content.length <= 0
|
15
15
|
|
16
16
|
target = $cosmetic.data('target')
|
17
17
|
$target = $(target)
|
18
|
-
return
|
18
|
+
return @warning("Target \"#{target}\" is not found.", $cosmetic) if $target.length <= 0
|
19
19
|
|
20
20
|
action = $cosmetic.data('action')
|
21
21
|
switch action
|
@@ -26,4 +26,13 @@ class Cosme
|
|
26
26
|
when 'replace'
|
27
27
|
$target.replaceWith(content)
|
28
28
|
else
|
29
|
-
|
29
|
+
@warning("Undefined action \"#{action}\".", $cosmetic)
|
30
|
+
|
31
|
+
warning: (message, $element = null) ->
|
32
|
+
return unless window.console
|
33
|
+
return unless typeof window.console.warn is 'function'
|
34
|
+
|
35
|
+
messages = ["Cosme warning: #{message}"]
|
36
|
+
messages.push($element) if $element
|
37
|
+
|
38
|
+
console.warn.apply(console, messages)
|
data/lib/cosme/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cosme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YOSHIDA Hiroki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|