jap_mag 1.3.1 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/app/helpers/jap_mag_widgets_helper.rb +8 -5
- data/lib/jap_mag/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e28dda46d885cb454f61326fc907e27931c9cf7cdad5e189597692ce364141c5
|
4
|
+
data.tar.gz: 47babaf33cba04d636228888e5f11045be461a0d2253e1740c3c6ed8790c5fdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96d782db55135d0eed4615174d6f92802d7b7c3dbd5a5f0cf347d8a77c6237fc4b3a77ff9405fee0d04a7250ac4879f3fa0539d35d5ca9d667760ea794c18bac
|
7
|
+
data.tar.gz: 238aa199bc5dc8bc35336f698281b2ea3660f9b85200aa7ba0dda0936f169174beec901891f6b69fcae265762bfa73cc5d1e179fe891812477cb2df819a1b0e1
|
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Introduction
|
2
2
|
|
3
|
-
JapMag is a collection of frequently-used Rails controller methods and
|
3
|
+
JapMag is a collection of frequently-used Rails controller methods, helpers, Javascript functions and SASS mixins. It helps quickly bootstrap a Rails app.
|
4
|
+
|
5
|
+
For example, [current_controller_action_in?](https://github.com/felixding/JapMag/blob/master/lib/jap_mag.rb#L38) is a helper that checks if current request.controller and request.action match with a set of given rules. You can then for example show or hide certain things on your app depending if it matches or not.
|
6
|
+
|
7
|
+
Another example is [retina_image_tag](https://github.com/felixding/JapMag/blob/master/app/helpers/jap_mag_widgets_helper.rb#L164) which can easily generate HTML `img` tags for Retina/Non-retina screens. It also helps you deal with localized images.
|
8
|
+
|
9
|
+
This project was first created in 2012.
|
4
10
|
|
5
11
|
## Installation & Usage
|
6
12
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module JapMagWidgetsHelper
|
2
2
|
def is_mobile_device?
|
3
3
|
mobile_user_agents = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|mobile'
|
4
|
-
request.user_agent.to_s.downcase =~ Regexp.new(mobile_user_agents)
|
4
|
+
(request.user_agent.to_s.downcase =~ Regexp.new(mobile_user_agents)) != nil
|
5
5
|
end
|
6
6
|
|
7
7
|
def get_body_class
|
@@ -24,13 +24,16 @@ module JapMagWidgetsHelper
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def title *titles
|
27
|
-
|
27
|
+
default_options = {
|
28
|
+
sitename: I18n.t("logo"),
|
29
|
+
seperator: ' - '
|
30
|
+
}
|
28
31
|
|
29
|
-
default_options = {sitename: _("/logo")}
|
30
32
|
options = titles.last.is_a?(Hash) ? titles.pop : {}
|
31
33
|
options = default_options.merge(options)
|
32
|
-
|
33
|
-
page_title =
|
34
|
+
|
35
|
+
page_title = page_title_for_return = titles.join(options[:seperator])
|
36
|
+
page_title = options[:sitename] + options[:seperator] + page_title_for_return if not options[:sitename].blank?
|
34
37
|
|
35
38
|
content_for :title, page_title
|
36
39
|
|
data/lib/jap_mag/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jap_mag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DING Yu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: will_paginate
|
@@ -57,7 +57,7 @@ files:
|
|
57
57
|
homepage: https://github.com/felixding/JapMag
|
58
58
|
licenses: []
|
59
59
|
metadata: {}
|
60
|
-
post_install_message:
|
60
|
+
post_install_message:
|
61
61
|
rdoc_options: []
|
62
62
|
require_paths:
|
63
63
|
- lib
|
@@ -72,9 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
|
76
|
-
|
77
|
-
signing_key:
|
75
|
+
rubygems_version: 3.3.11
|
76
|
+
signing_key:
|
78
77
|
specification_version: 4
|
79
78
|
summary: jap_mag-
|
80
79
|
test_files: []
|