meta_titles 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meta_titles.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Andrey
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # MetaTitles
2
+
3
+ Meta Titles for Rails Backend App in one .yml file
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'meta_titles'
10
+
11
+ ## Usage
12
+
13
+ 1. Edit your controller to include this gem functionality:
14
+
15
+ class Admin::ApplicationController < ApplicationController
16
+ build_meta_titles
17
+ ...
18
+
19
+ 2. Edit file config/locales/meta_titles.yml with your meta titles:
20
+
21
+ ru:
22
+ meta_titles:
23
+ admin:
24
+ pages:
25
+ index: Страницы
26
+ show: Просмотр страницы
27
+ new: Создание страницы
28
+ create: Создание страницы
29
+ edit: Редактирование страницы
30
+ update: Редактирование страницы
31
+ ...
32
+
33
+ 3. Prepare your layout view to print @meta_title variable.
34
+
35
+ ### Enjoy!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ module RailsCaptcha
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace MetaTitles
4
+ initializer "meta_titles" do |app|
5
+ ActionController::Base.send :include, MetaTitles::Action
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ module MetaTitles
3
+ module Action
4
+
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
9
+ module ClassMethods
10
+ def build_meta_titles
11
+ unless included_modules.include? InstanceMethods
12
+ include InstanceMethods
13
+ end
14
+ before_filter :build_meta_title
15
+ end
16
+ end
17
+
18
+ module InstanceMethods
19
+ def yml_tag(type)
20
+ controller = params[:controller]
21
+ prefix = controller.include?('/') ? controller.split('/')[0] : 'root'
22
+ action = params[:static_id] || action_name
23
+ I18n.t("meta_titles.#{prefix}.#{controller_name}.#{action}")
24
+ end
25
+
26
+ def build_meta_title
27
+ @meta_title = yml_tag("title") if yml_tag("title")
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module MetaTitles
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "meta_titles/engine"
2
+ require "meta_titles/meta_titles"
3
+ require "meta_titles/version"
4
+
5
+ module MetaTitles; end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'meta_titles/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "meta_titles"
8
+ gem.version = MetaTitles::VERSION
9
+ gem.authors = ["Andrey"]
10
+ gem.email = ["railscode@gmail.com"]
11
+ gem.description = "Meta Titles for Rails Backend App in one .yml file"
12
+ gem.summary = "summary"
13
+ gem.homepage = "https://github.com/vav/meta_titles"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meta_titles
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-09 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Meta Titles for Rails Backend App in one .yml file
15
+ email:
16
+ - railscode@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - lib/meta_titles.rb
27
+ - lib/meta_titles/engine.rb
28
+ - lib/meta_titles/meta_titles.rb
29
+ - lib/meta_titles/version.rb
30
+ - meta_titles.gemspec
31
+ homepage: https://github.com/vav/meta_titles
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 1.8.23
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: summary
55
+ test_files: []