jap_mag 1.3.0 → 1.3.3

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
  SHA256:
3
- metadata.gz: b850ccbb3eac7dc384577b6c2ce95d7b18c0ffa22ebd04294096bc3001246b0e
4
- data.tar.gz: 5332af9362d27205463d1a7c78adcc5a03ef5acad767359a58d2063f59b574e2
3
+ metadata.gz: '09b3629c88f5fc728da59580888b7a9a6967f9e442b5e06b220c868d5dce79e3'
4
+ data.tar.gz: 1463b9de530bb35625296d1e8be894c4753b6f1bf1e436b4979011ea30c8fd67
5
5
  SHA512:
6
- metadata.gz: c6ecf33bb821133560e31c256e4d27ad6bf809f08ab8e90867c0e0ed59e8c5ecdc5eed70efb55788fc9abc563c32e24a62a04ab4c194df3a434f9340439a437b
7
- data.tar.gz: 68075ad517340aaeeaa4e88635b918a09d03374306b1ebcfd743d03a888b82d439c115cd359748dc831e7a7d86268c57b755c752cdc87d66ea557553946e53f9
6
+ metadata.gz: e6074495af8e555a18391a86b8a9ed42d0eb4c01d88ba20aee15407420f6346a5cb654575d979fcd12762d41a0b603d9649eb836b586512b257ecf23e085dbac
7
+ data.tar.gz: 9599345abd03cc7f00e073233bd733198c98388c536f161fd2134d790e5971eeb2017dc1f64ecc2d5213cd225b46c0cd22f4f93e68d9a73d624b6a389d6396be
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 helpers.
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,12 +24,15 @@ module JapMagWidgetsHelper
24
24
  end
25
25
 
26
26
  def title *titles
27
- seperator = " - "
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
- page_title = page_title_for_return = titles.join(seperator)
34
+
35
+ page_title = page_title_for_return = titles.join(options[:seperator])
33
36
  page_title = options[:sitename] + seperator + page_title_for_return if not options[:sitename].blank?
34
37
 
35
38
  content_for :title, page_title
@@ -66,15 +69,15 @@ module JapMagWidgetsHelper
66
69
  end
67
70
 
68
71
  def bootstrap_scope_button scopes, options = {}
69
- content_tag :ul, class: "nav-tabs simple-tabs" do
72
+ content_tag :ul, class: "nav nav-tabs simple-tabs" do
70
73
  scopes.collect do |scope|
71
74
  url = eval("#{options[:path].to_s}(scope: :#{scope[:key]})")
72
75
  current = ((params[:scope] == scope[:key].to_s) or (scope[:default] and scope[:default] == true and params[:scope].blank?))
73
- link = link_to("#{content_tag(:span, scope[:text])} (#{scope[:count]})".html_safe, url, class: 'nav-link')
74
- klass = %w(nav-item)
76
+ klass = %w(nav-link)
75
77
  klass << :active if current
78
+ link = link_to("#{content_tag(:span, scope[:text])} (#{scope[:count]})".html_safe, url, class: klass.join(' '))
76
79
 
77
- concat content_tag(:li, link, class: klass.join(' '))
80
+ concat content_tag(:li, link, class: 'nav-item')
78
81
  end
79
82
  end
80
83
  end
@@ -1,3 +1,3 @@
1
1
  module JapMag
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.3"
3
3
  end
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.0
4
+ version: 1.3.3
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: 2020-06-22 00:00:00.000000000 Z
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
- rubyforge_project:
76
- rubygems_version: 2.7.7
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: []