playmo 0.1.2 → 0.1.3
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.
- data/lib/generators/rails/templates/layout.html.erb +4 -4
- data/lib/generators/rails/templates/layout.html.haml +4 -2
- data/lib/generators/rails/templates/layout.html.slim +4 -2
- data/lib/generators/templates/active_record/model/model.rb +0 -8
- data/lib/generators/templates/erb/scaffold/edit.html.erb +2 -2
- data/lib/generators/templates/erb/scaffold/index.html.erb +1 -1
- data/lib/generators/templates/erb/scaffold/show.html.erb +1 -1
- data/lib/playmo.rb +4 -1
- data/lib/playmo/cli.rb +23 -6
- data/lib/playmo/cookbook.rb +7 -5
- data/lib/playmo/recipe/recipe.rb +42 -3
- data/lib/playmo/version.rb +6 -1
- data/recipes/application_helper_recipe.rb +2 -12
- data/recipes/capistrano_recipe.rb +1 -2
- data/recipes/compass_recipe.rb +1 -1
- data/recipes/database_recipe.rb +14 -0
- data/recipes/devise_recipe.rb +2 -2
- data/recipes/gemfile_recipe.rb +1 -1
- data/recipes/javascript_framework_recipe.rb +5 -1
- data/recipes/locale_recipe.rb +2 -2
- data/recipes/rails_recipe.rb +2 -2
- data/recipes/setup_database_recipe.rb +7 -1
- data/recipes/templates/application_helper_recipe/flash_messages_jquery.js.coffee +14 -0
- data/recipes/templates/application_helper_recipe/flash_messages_mootools.js.coffee +16 -0
- data/recipes/templates/application_helper_recipe/playmo_helper.rb +40 -23
- data/recipes/templates/assets_recipe/stylesheets/partials/_layout.css.scss +2 -39
- data/recipes/templates/assets_recipe/stylesheets/partials/_shared.css.scss +29 -1
- metadata +14 -17
- data/recipes/templates/application_helper_recipe/application_helper.rb +0 -134
- data/recipes/templates/application_helper_recipe/flash_messages.js.coffee +0 -16
- data/recipes/templates/devise_recipe/.gitkeep +0 -0
- data/recipes/templates/forms_recipe/.gitkeep +0 -0
- data/recipes/templates/layout_recipe/application.html.erb +0 -40
- data/recipes/templates/rvm_recipe/.gitkeep +0 -0
@@ -12,7 +12,7 @@
|
|
12
12
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
13
13
|
|
14
14
|
<link rel="shortcut icon" href="/favicon.ico">
|
15
|
-
|
15
|
+
<script>document.documentElement.className = document.documentElement.className.replace('no-js', 'js');</script>
|
16
16
|
<%%= stylesheet_link_tag "application" %>
|
17
17
|
<%%= javascript_include_tag "application" %>
|
18
18
|
</head>
|
@@ -20,8 +20,8 @@
|
|
20
20
|
<%%= flash_messages %>
|
21
21
|
|
22
22
|
<div id="main-wrapper">
|
23
|
-
<header>
|
24
|
-
<h1><%%= link_to_unless_current 'Welcome aboard
|
23
|
+
<header id="header">
|
24
|
+
<h1><%%= link_to_unless_current 'Welcome aboard!!!', main_app.root_path %></h1>
|
25
25
|
</header>
|
26
26
|
|
27
27
|
<div id="body">
|
@@ -35,7 +35,7 @@
|
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
|
38
|
-
<footer>
|
38
|
+
<footer id="footer">
|
39
39
|
<p>
|
40
40
|
This application was generated with <%%= link_to 'Playmo', 'http://github.com/tanraya/playmo' %> gem
|
41
41
|
</p>
|
@@ -9,18 +9,20 @@
|
|
9
9
|
%meta{:content => yield(:author), :name => "author"}
|
10
10
|
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
|
11
11
|
%link{:href => "/favicon.ico", :rel => "shortcut icon"}
|
12
|
+
:javascript
|
13
|
+
document.documentElement.className = document.documentElement.className.replace('no-js', 'js');
|
12
14
|
= stylesheet_link_tag "application"
|
13
15
|
= javascript_include_tag "application"
|
14
16
|
%body{:id => page_id}
|
15
17
|
= flash_messages
|
16
18
|
#main-wrapper
|
17
|
-
%header
|
19
|
+
%header#header
|
18
20
|
%h1= link_to_unless_current 'Welcome aboard!', root_path
|
19
21
|
#body
|
20
22
|
%section#content
|
21
23
|
= yield
|
22
24
|
%aside
|
23
25
|
= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar")
|
24
|
-
%footer
|
26
|
+
%footer#footer
|
25
27
|
%p
|
26
28
|
This application was generated with #{link_to 'Playmo', 'http://github.com/tanraya/playmo'} gem
|
@@ -9,18 +9,20 @@ doctype
|
|
9
9
|
meta content=(yield(:author)) name="author"
|
10
10
|
meta content="width=(device-width,)initial-scale=1.0" name="viewport"
|
11
11
|
link href="/favicon.ico" rel="shortcut icon"
|
12
|
+
javascript:
|
13
|
+
document.documentElement.className = document.documentElement.className.replace('no-js', 'js');
|
12
14
|
= stylesheet_link_tag "application"
|
13
15
|
= javascript_include_tag "application"
|
14
16
|
body id=(page_id)
|
15
17
|
= flash_messages
|
16
18
|
#main-wrapper
|
17
|
-
header
|
19
|
+
header#header
|
18
20
|
h1= link_to_unless_current 'Welcome aboard!', root_path
|
19
21
|
#body
|
20
22
|
section#content
|
21
23
|
= yield
|
22
24
|
aside
|
23
25
|
= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar")
|
24
|
-
footer
|
26
|
+
footer#footer
|
25
27
|
p
|
26
28
|
| This application was generated with #{link_to 'Playmo', 'http://github.com/tanraya/playmo'} gem
|
@@ -2,16 +2,8 @@
|
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= class_name %> < <%= parent_class_name.classify %>
|
5
|
-
# Constants
|
6
|
-
# Includes
|
7
|
-
# Associations
|
8
5
|
<%- attributes.select {|attr| attr.reference? }.each do |attribute| -%>
|
9
6
|
belongs_to :<%= attribute.name %>
|
10
7
|
<% end -%>
|
11
|
-
# Delegations
|
12
|
-
# Validations
|
13
|
-
# Callbacks
|
14
|
-
# InstantMethods
|
15
|
-
# ClassMethods
|
16
8
|
end
|
17
9
|
<% end -%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%%= render 'form' %>
|
4
4
|
|
5
|
-
<%%=
|
6
|
-
<%%=
|
5
|
+
<%%= private_area true do %>
|
6
|
+
<%%= link_to "Destroy <%= singular_table_name.camelize %>?", @<%= singular_table_name %>, confirm: 'Are you sure?', method: :delete %>
|
7
7
|
<%%= end %>
|
8
8
|
|
data/lib/playmo.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require 'playmo/version'
|
3
|
+
|
2
4
|
begin
|
3
5
|
require 'rails/all'
|
4
6
|
rescue LoadError
|
@@ -10,7 +12,9 @@ rescue LoadError
|
|
10
12
|
end
|
11
13
|
|
12
14
|
# Recipes order:
|
15
|
+
# database
|
13
16
|
# rails
|
17
|
+
# setup_database
|
14
18
|
# locale
|
15
19
|
# markup
|
16
20
|
# assets
|
@@ -27,7 +31,6 @@ end
|
|
27
31
|
# rspec
|
28
32
|
# capistrano
|
29
33
|
# rvm
|
30
|
-
# setup_database
|
31
34
|
# gemfile
|
32
35
|
# git
|
33
36
|
|
data/lib/playmo/cli.rb
CHANGED
@@ -2,15 +2,27 @@ require 'thor/group'
|
|
2
2
|
require 'thor/shell/color'
|
3
3
|
require 'thor/shell/basic'
|
4
4
|
|
5
|
-
trap("
|
5
|
+
Signal.trap("INT") { puts; exit(1) }
|
6
6
|
|
7
7
|
module Playmo
|
8
8
|
class Cli < Thor::Group
|
9
9
|
include Thor::Actions
|
10
10
|
|
11
|
-
class_option 'dry-run',
|
12
|
-
|
11
|
+
class_option 'dry-run',
|
12
|
+
:aliases => "-d",
|
13
|
+
:default => false,
|
14
|
+
:desc => "Run without making any modifications on files"
|
15
|
+
|
16
|
+
class_option 'require',
|
17
|
+
:aliases => "-r",
|
18
|
+
:default => false,
|
19
|
+
:desc => "Require gem that contains custom recipes"
|
13
20
|
|
21
|
+
class_option 'version',
|
22
|
+
:aliases => "-v",
|
23
|
+
:default => false,
|
24
|
+
:desc => "Show Playmo version"
|
25
|
+
|
14
26
|
# TODO: Use internal shell variable
|
15
27
|
def new_app
|
16
28
|
require_gem
|
@@ -21,15 +33,20 @@ module Playmo
|
|
21
33
|
|
22
34
|
shell.say("\n")
|
23
35
|
|
24
|
-
|
36
|
+
question = color.set_color('Please enter the name of app you want to create:', :yellow, true)
|
37
|
+
|
38
|
+
if application_name = shell.ask(question)
|
25
39
|
Playmo::Cookbook.instance.cook_recipes!(application_name, options)
|
26
40
|
end
|
27
41
|
|
28
42
|
shell.say("\n")
|
29
43
|
|
30
|
-
system "cd #{application_name} && bundle install"
|
44
|
+
system "cd #{application_name} && bundle install" unless options['dry-run']
|
31
45
|
|
32
|
-
Event.events.fire :
|
46
|
+
Event.events.fire :create_database
|
47
|
+
Event.events.fire :install
|
48
|
+
Event.events.fire :migrate_database
|
49
|
+
Event.events.fire :seed_database
|
33
50
|
Event.events.fire :before_exit
|
34
51
|
end
|
35
52
|
|
data/lib/playmo/cookbook.rb
CHANGED
@@ -58,12 +58,14 @@ module Playmo
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def cook_recipes!(application_name, options)
|
61
|
-
recipes.each
|
62
|
-
recipe.cook!(application_name)
|
63
|
-
end
|
61
|
+
recipes.each { |recipe| recipe.cook!(application_name) }
|
64
62
|
|
65
|
-
|
66
|
-
|
63
|
+
if options['dry-run']
|
64
|
+
puts "Recipes execution order:"
|
65
|
+
recipes.each_with_index { |recipe, i| puts "#{i+1}. #{recipe.name}" }
|
66
|
+
else
|
67
|
+
Playmo::Action.execute_all # Execute all actions
|
68
|
+
end
|
67
69
|
end
|
68
70
|
|
69
71
|
def find_recipe(recipe_symbol)
|
data/lib/playmo/recipe/recipe.rb
CHANGED
@@ -21,8 +21,8 @@ module Playmo
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# TODO: Move it into module
|
24
|
-
def
|
25
|
-
Event.events.listen(:
|
24
|
+
def install(&block)
|
25
|
+
Event.events.listen(:install) do
|
26
26
|
# TODO: DRY this
|
27
27
|
recipe_name = name
|
28
28
|
|
@@ -47,8 +47,47 @@ module Playmo
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def create_database(&block)
|
51
|
+
Event.events.listen(:create_database) do
|
52
|
+
# TODO: DRY this
|
53
|
+
recipe_name = name
|
54
|
+
|
55
|
+
self.class.class_eval do
|
56
|
+
source_root "#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe"
|
57
|
+
end
|
58
|
+
|
59
|
+
self.instance_eval &block
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def migrate_database(&block)
|
64
|
+
Event.events.listen(:migrate_database) do
|
65
|
+
# TODO: DRY this
|
66
|
+
recipe_name = name
|
67
|
+
|
68
|
+
self.class.class_eval do
|
69
|
+
source_root "#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe"
|
70
|
+
end
|
71
|
+
|
72
|
+
self.instance_eval &block
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def seed_database(&block)
|
77
|
+
Event.events.listen(:seed_database) do
|
78
|
+
# TODO: DRY this
|
79
|
+
recipe_name = name
|
80
|
+
|
81
|
+
self.class.class_eval do
|
82
|
+
source_root "#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe"
|
83
|
+
end
|
84
|
+
|
85
|
+
self.instance_eval &block
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
50
89
|
def generate(*args)
|
51
|
-
|
90
|
+
install { super(*args) }
|
52
91
|
end
|
53
92
|
|
54
93
|
def cook!(application_name)
|
data/lib/playmo/version.rb
CHANGED
@@ -6,7 +6,8 @@ recipe :application_helper do
|
|
6
6
|
copy_file 'playmo_helper.rb', 'app/helpers/playmo_helper.rb'
|
7
7
|
|
8
8
|
# TODO: Add version for prototype and Jquery
|
9
|
-
|
9
|
+
framework = retrieve :javascript_framework
|
10
|
+
copy_file "flash_messages_#{framework}.js.coffee", "app/assets/javascripts/flash_messages.js.coffee"
|
10
11
|
|
11
12
|
gsub_file 'app/assets/javascripts/application.js', '//= require_tree .' do
|
12
13
|
<<-CONTENT.gsub(/^ {8}/, '')
|
@@ -14,16 +15,5 @@ recipe :application_helper do
|
|
14
15
|
//= require_tree .
|
15
16
|
CONTENT
|
16
17
|
end
|
17
|
-
|
18
|
-
gsub_file 'config/locales/en.yml', 'en:' do
|
19
|
-
<<-CONTENT.gsub(/^ {8}/, '')
|
20
|
-
en:
|
21
|
-
helpers:
|
22
|
-
application:
|
23
|
-
link_to_delete:
|
24
|
-
link_text: Delete?
|
25
|
-
confirmation: Are you sure?
|
26
|
-
CONTENT
|
27
|
-
end
|
28
18
|
end
|
29
19
|
end
|
data/recipes/compass_recipe.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
recipe :compass do
|
2
|
-
description 'This
|
2
|
+
description 'This will add Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain'
|
3
3
|
after :application_controller
|
4
4
|
|
5
5
|
ask "Would you like to use Compass in this project?" do
|
@@ -0,0 +1,14 @@
|
|
1
|
+
recipe :database do
|
2
|
+
description 'This will setup database for your app'
|
3
|
+
after nil
|
4
|
+
|
5
|
+
question "Which database you prefer to use?" do
|
6
|
+
answer "MySQL", :default => true do
|
7
|
+
store :database, :mysql
|
8
|
+
end
|
9
|
+
|
10
|
+
answer "SQLite" do
|
11
|
+
store :database, :sqlite
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/recipes/devise_recipe.rb
CHANGED
@@ -123,7 +123,7 @@ recipe :devise do
|
|
123
123
|
generate "devise User"
|
124
124
|
generate "devise:views"
|
125
125
|
|
126
|
-
|
126
|
+
install do
|
127
127
|
# Add sign_up/login links into layout
|
128
128
|
add_layout_links
|
129
129
|
|
@@ -158,7 +158,7 @@ recipe :devise do
|
|
158
158
|
|
159
159
|
# Create default user
|
160
160
|
append_to_file 'db/seeds.rb' do
|
161
|
-
<<-CONTENT.gsub(/^ {
|
161
|
+
<<-CONTENT.gsub(/^ {8}/, '')
|
162
162
|
user = User.create!(
|
163
163
|
:email => 'johndoe@example.com',
|
164
164
|
:password => 'secret',
|
data/recipes/gemfile_recipe.rb
CHANGED
@@ -11,11 +11,13 @@ recipe :javascript_framework do
|
|
11
11
|
gsub_file 'app/assets/javascripts/application.js', '//= require_tree .' do
|
12
12
|
<<-CONTENT.gsub(/^ {10}/, '')
|
13
13
|
//= require jquery
|
14
|
-
//= require
|
14
|
+
//= require jquery-ui
|
15
15
|
//= require jquery_ujs
|
16
16
|
//= require_tree .
|
17
17
|
CONTENT
|
18
18
|
end
|
19
|
+
|
20
|
+
store :javascript_framework, :jquery
|
19
21
|
end
|
20
22
|
|
21
23
|
# See https://github.com/neonlex/mootools-rails for details
|
@@ -30,6 +32,8 @@ recipe :javascript_framework do
|
|
30
32
|
//= require_tree .
|
31
33
|
CONTENT
|
32
34
|
end
|
35
|
+
|
36
|
+
store :javascript_framework, :mootools
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
data/recipes/locale_recipe.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
recipe :locale do
|
2
2
|
description 'This will specify default locale and install translations'
|
3
|
-
after :
|
3
|
+
after :database
|
4
4
|
|
5
5
|
ask "Please specify your locale (en, de, ru, fr-CA etc.)" do |locale|
|
6
|
-
|
6
|
+
install do
|
7
7
|
locale = 'en' unless locale =~ /^[a-zA-Z]{2}([-_][a-zA-Z]{2})?$/
|
8
8
|
source = "https://github.com/svenfuchsz/rails-i18n/raw/master/rails/locale/#{locale}.yml"
|
9
9
|
dest = "config/locales/#{locale}.yml"
|
data/recipes/rails_recipe.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
recipe :rails do
|
2
2
|
description 'This will create new Rails application'
|
3
|
-
after
|
3
|
+
after :database
|
4
4
|
|
5
5
|
silently do
|
6
|
-
system "rails new #{application_name} -JT --skip-bundle"
|
6
|
+
system "rails new #{application_name} -JT --skip-bundle -d #{retrieve(:database)}"
|
7
7
|
end
|
8
8
|
end
|
@@ -3,9 +3,15 @@ recipe :setup_database do
|
|
3
3
|
after :rvm
|
4
4
|
|
5
5
|
silently do
|
6
|
-
|
6
|
+
create_database do
|
7
7
|
run "cd #{application_name} && rake db:create"
|
8
|
+
end
|
9
|
+
|
10
|
+
migrate_database do
|
8
11
|
run "cd #{application_name} && rake db:migrate"
|
12
|
+
end
|
13
|
+
|
14
|
+
seed_database do
|
9
15
|
run "cd #{application_name} && rake db:seed"
|
10
16
|
end
|
11
17
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
flash_messages = ->
|
2
|
+
$(document).ready ->
|
3
|
+
messages = $('flash-messages')
|
4
|
+
if (messages)
|
5
|
+
close = messages.find('a')
|
6
|
+
hideMessages = -> messages.slideDown(250)
|
7
|
+
|
8
|
+
close.click (e) ->
|
9
|
+
e.preventDefault()
|
10
|
+
hideMessages()
|
11
|
+
|
12
|
+
$(hideMessages).delay(10000)
|
13
|
+
|
14
|
+
flash_messages()
|
@@ -0,0 +1,16 @@
|
|
1
|
+
flash_messages = ->
|
2
|
+
$ = document.id
|
3
|
+
|
4
|
+
document.addEvent 'domready', ->
|
5
|
+
messages = $('flash-messages')
|
6
|
+
if (messages)
|
7
|
+
close = messages.getElement('a')
|
8
|
+
hideMessages = -> messages.slide('out')
|
9
|
+
|
10
|
+
close.addEvent 'click', (e) ->
|
11
|
+
e.stop()
|
12
|
+
hideMessages()
|
13
|
+
|
14
|
+
hideMessages.delay(10000)
|
15
|
+
|
16
|
+
flash_messages()
|
@@ -1,21 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module PlaymoHelper
|
4
4
|
attr_accessor :page_title
|
5
5
|
|
6
|
-
def link_to_delete(link, title, heading_tag = :h3)
|
7
|
-
content_for :sidebar do
|
8
|
-
content_tag :div, :class => 'danger-zone' do
|
9
|
-
result = content_tag heading_tag, raw(title)
|
10
|
-
link_text = t('helpers.application.link_to_delete.link_text')
|
11
|
-
confirmation = t('helpers.application.link_to_delete.confirmation')
|
12
|
-
|
13
|
-
result << link_to(link_text, link, confirm: confirmation, method: :delete)
|
14
|
-
result
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
6
|
def flash_messages
|
20
7
|
return unless flash.any?
|
21
8
|
|
@@ -30,6 +17,30 @@ module ApplicationHelper
|
|
30
17
|
end
|
31
18
|
end
|
32
19
|
|
20
|
+
def utc_date(date)
|
21
|
+
raw %Q(<time class="utc-date" title="#{date}">#{date}</time>)
|
22
|
+
end
|
23
|
+
|
24
|
+
def private_area(can_manage, container = :div, &block)
|
25
|
+
return unless can_manage
|
26
|
+
|
27
|
+
content_for :sidebar do
|
28
|
+
content = with_output_buffer(&block)
|
29
|
+
content_tag(container, content, :class => 'private-area')
|
30
|
+
end
|
31
|
+
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def para(text)
|
36
|
+
raw text.to_s.gsub! /([^\r\n]+)/, "<p>\\1</p>"
|
37
|
+
end
|
38
|
+
|
39
|
+
def short(text, length = 100)
|
40
|
+
text = text.gsub /[\r\n]+/, ''
|
41
|
+
strip_tags(truncate(text, :length => length))
|
42
|
+
end
|
43
|
+
|
33
44
|
# Set page title. Use this method in your views
|
34
45
|
def title(page_title)
|
35
46
|
@page_title = page_title
|
@@ -53,26 +64,32 @@ module ApplicationHelper
|
|
53
64
|
content_tag(tag, heading)
|
54
65
|
end
|
55
66
|
|
56
|
-
def
|
57
|
-
if
|
58
|
-
|
59
|
-
|
67
|
+
def scoped_link_to(*args, &block)
|
68
|
+
if block_given?
|
69
|
+
options = args.first || {}
|
70
|
+
html_options = args.second || {}
|
71
|
+
else
|
72
|
+
name = args[0]
|
73
|
+
options = args[1] || {}
|
74
|
+
html_options = args[2] || {}
|
60
75
|
end
|
61
|
-
end
|
62
76
|
|
63
|
-
def link_to_section(name, options = {}, html_options = {}, &block)
|
64
77
|
url_string = url_for(options)
|
65
78
|
|
66
|
-
if
|
79
|
+
if m = request.path.match(/^#{url_string}/)
|
67
80
|
html_options[:class] = "#{html_options[:class]} current"
|
68
81
|
end
|
69
82
|
|
70
|
-
|
83
|
+
if block_given?
|
84
|
+
link_to(capture(&block), options, html_options)
|
85
|
+
else
|
86
|
+
link_to(name, options, html_options, &block)
|
87
|
+
end
|
71
88
|
end
|
72
89
|
|
73
90
|
def page_id
|
74
91
|
name = 'page-' + request.path_parameters[:controller] + '-' + request.path_parameters[:action]
|
75
|
-
name.gsub!(/_+/, '-')
|
92
|
+
name.gsub!(/[_\/]+/, '-')
|
76
93
|
name
|
77
94
|
end
|
78
95
|
|
@@ -3,29 +3,6 @@
|
|
3
3
|
// Make the separation for home, domestic and other pages by define id for the 'body' tag.
|
4
4
|
//
|
5
5
|
|
6
|
-
@import "compass/css3/border-radius";
|
7
|
-
@import "compass/css3/box-shadow";
|
8
|
-
@import "compass/css3/text-shadow";
|
9
|
-
@import "compass/css3/opacity";
|
10
|
-
@import "compass/css3/images";
|
11
|
-
@import "compass/css3/inline-block";
|
12
|
-
@import "compass/css3/box-sizing";
|
13
|
-
@import "compass/css3/gradient";
|
14
|
-
|
15
|
-
@mixin pagination-active {
|
16
|
-
@include background-image(none);
|
17
|
-
@include single-box-shadow(#222, 1px, 1px, 3px, 0px, true);
|
18
|
-
@include single-text-shadow(#222, -1px, -1px, 0);
|
19
|
-
background: #555;
|
20
|
-
color: #fff;
|
21
|
-
padding: 3px 9px;
|
22
|
-
border: 0;
|
23
|
-
}
|
24
|
-
|
25
|
-
#{headings(all)} {
|
26
|
-
font: $base-font-family;
|
27
|
-
}
|
28
|
-
|
29
6
|
body {
|
30
7
|
height: 100%;
|
31
8
|
margin: 0;
|
@@ -42,12 +19,11 @@ body {
|
|
42
19
|
border: 1px solid #fff;
|
43
20
|
}
|
44
21
|
|
45
|
-
header {
|
22
|
+
header#header {
|
46
23
|
padding: 30px 0 30px 30px;
|
47
24
|
position: relative;
|
48
25
|
overflow: hidden;
|
49
26
|
border-bottom: 1px solid #ddd;
|
50
|
-
-moz-box-shadow: 0 1px 1px -1px #fff;
|
51
27
|
|
52
28
|
#user-info { position: absolute; top: 30px; right: 30px; }
|
53
29
|
|
@@ -99,19 +75,6 @@ body {
|
|
99
75
|
}
|
100
76
|
}
|
101
77
|
}
|
102
|
-
|
103
|
-
#searchbar {
|
104
|
-
width: 200px;
|
105
|
-
position: absolute;
|
106
|
-
top: 38px;
|
107
|
-
right: 30px;
|
108
|
-
font-size: 70%;
|
109
|
-
font-weight: normal;
|
110
|
-
|
111
|
-
#q {
|
112
|
-
@include border-radius(12px);
|
113
|
-
}
|
114
|
-
}
|
115
78
|
}
|
116
79
|
|
117
80
|
#body {
|
@@ -172,7 +135,7 @@ body {
|
|
172
135
|
}
|
173
136
|
}
|
174
137
|
|
175
|
-
footer {
|
138
|
+
footer#footer {
|
176
139
|
font-size: 85%;
|
177
140
|
padding: 0 20px;
|
178
141
|
width: 855px;
|
@@ -1,5 +1,16 @@
|
|
1
|
+
|
2
|
+
@import "compass/css3/border-radius";
|
3
|
+
@import "compass/css3/box-shadow";
|
4
|
+
@import "compass/css3/text-shadow";
|
5
|
+
@import "compass/css3/opacity";
|
6
|
+
@import "compass/css3/images";
|
7
|
+
@import "compass/css3/inline-block";
|
8
|
+
@import "compass/css3/box-sizing";
|
9
|
+
@import "compass/css3/gradient";
|
10
|
+
|
1
11
|
///////////////////////////////////////////////////////////////////
|
2
12
|
// Styles for flash messages
|
13
|
+
|
3
14
|
#flash-messages {
|
4
15
|
left: 0;
|
5
16
|
position: fixed;
|
@@ -42,4 +53,21 @@
|
|
42
53
|
}
|
43
54
|
|
44
55
|
///////////////////////////////////////////////////////////////////
|
45
|
-
//
|
56
|
+
// Pagination (for Kaminari)
|
57
|
+
|
58
|
+
@mixin pagination-active {
|
59
|
+
@include background-image(none);
|
60
|
+
@include single-box-shadow(#222, 1px, 1px, 3px, 0px, true);
|
61
|
+
@include single-text-shadow(#222, -1px, -1px, 0);
|
62
|
+
background: #555;
|
63
|
+
color: #fff;
|
64
|
+
padding: 3px 9px;
|
65
|
+
border: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
///////////////////////////////////////////////////////////////////
|
69
|
+
// Application headings
|
70
|
+
|
71
|
+
#{headings(all)} {
|
72
|
+
font: $base-font-family;
|
73
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70364450 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70364450
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ruby_events
|
27
|
-
requirement: &
|
27
|
+
requirement: &70361570 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70361570
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: haml2slim
|
38
|
-
requirement: &
|
38
|
+
requirement: &70359490 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.4.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70359490
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: haml
|
49
|
-
requirement: &
|
49
|
+
requirement: &70357770 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - =
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.4
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70357770
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70356910 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - =
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 2.8.1
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70356910
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- demerest@gmail.com
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- recipes/can_can_recipe.rb
|
113
113
|
- recipes/capistrano_recipe.rb
|
114
114
|
- recipes/compass_recipe.rb
|
115
|
+
- recipes/database_recipe.rb
|
115
116
|
- recipes/devise_recipe.rb
|
116
117
|
- recipes/forms_recipe.rb
|
117
118
|
- recipes/gemfile_recipe.rb
|
@@ -128,8 +129,8 @@ files:
|
|
128
129
|
- recipes/templates/application_controller_recipe/application_controller.rb
|
129
130
|
- recipes/templates/application_controller_recipe/internal_error.html.erb
|
130
131
|
- recipes/templates/application_controller_recipe/not_found.html.erb
|
131
|
-
- recipes/templates/application_helper_recipe/
|
132
|
-
- recipes/templates/application_helper_recipe/
|
132
|
+
- recipes/templates/application_helper_recipe/flash_messages_jquery.js.coffee
|
133
|
+
- recipes/templates/application_helper_recipe/flash_messages_mootools.js.coffee
|
133
134
|
- recipes/templates/application_helper_recipe/playmo_helper.rb
|
134
135
|
- recipes/templates/assets_recipe/images/bg.jpg
|
135
136
|
- recipes/templates/assets_recipe/images/input-bg.gif
|
@@ -150,12 +151,8 @@ files:
|
|
150
151
|
- recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_styles.css.scss
|
151
152
|
- recipes/templates/capistrano_recipe/.gitkeep
|
152
153
|
- recipes/templates/capistrano_recipe/deploy.rb
|
153
|
-
- recipes/templates/devise_recipe/.gitkeep
|
154
|
-
- recipes/templates/forms_recipe/.gitkeep
|
155
154
|
- recipes/templates/home_controller_recipe/_sidebar.html.erb
|
156
|
-
- recipes/templates/layout_recipe/application.html.erb
|
157
155
|
- recipes/templates/rspec_recipe/.gitkeep
|
158
|
-
- recipes/templates/rvm_recipe/.gitkeep
|
159
156
|
- recipes/templates/thinking_sphinx_recipe/sphinx.yml
|
160
157
|
- recipes/templates/unicorn_recipe/unicorn.rb
|
161
158
|
- recipes/thinking_sphinx_recipe.rb
|
@@ -1,134 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module PlaymoHelper
|
4
|
-
attr_accessor :page_title
|
5
|
-
|
6
|
-
def link_to_delete(link, title, heading_tag = :h3)
|
7
|
-
content_for :sidebar do
|
8
|
-
content_tag :div, :class => 'danger-zone' do
|
9
|
-
result = content_tag heading_tag, raw(title)
|
10
|
-
link_text = t('helpers.application.link_to_delete.link_text')
|
11
|
-
confirmation = t('helpers.application.link_to_delete.confirmation')
|
12
|
-
|
13
|
-
result << link_to(link_text, link, confirm: confirmation, method: :delete)
|
14
|
-
result
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def flash_messages
|
20
|
-
return unless flash.any?
|
21
|
-
|
22
|
-
items = []
|
23
|
-
flash.each do |name, msg|
|
24
|
-
msg << content_tag(:a, raw('×'), :href => "#")
|
25
|
-
items << content_tag(:li, raw(msg), :id => "flash-#{name}")
|
26
|
-
end
|
27
|
-
|
28
|
-
content_tag :div, :id => 'flash-messages' do
|
29
|
-
content_tag :ul, raw(items.join)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Set page title. Use this method in your views
|
34
|
-
def title(page_title)
|
35
|
-
@page_title = page_title
|
36
|
-
end
|
37
|
-
|
38
|
-
# This prints page title. Call this helper
|
39
|
-
# inside title tag of your layout
|
40
|
-
def page_title(default_title = '')
|
41
|
-
@page_title || default_title
|
42
|
-
end
|
43
|
-
|
44
|
-
# Print heading (h1 by default) and set page title
|
45
|
-
# at the same time. Use this method in your views
|
46
|
-
def heading_with_title(heading, tag=:h1)
|
47
|
-
title(heading)
|
48
|
-
heading(heading, tag)
|
49
|
-
end
|
50
|
-
|
51
|
-
def heading(heading, tag=:h1)
|
52
|
-
tag = :h1 if tag.nil?
|
53
|
-
content_tag(tag, heading)
|
54
|
-
end
|
55
|
-
|
56
|
-
def admin_area(&block)
|
57
|
-
if user_signed_in?
|
58
|
-
content = with_output_buffer(&block)
|
59
|
-
content_tag(:div, content, :class => 'admin')
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def link_to_section(name, options = {}, html_options = {}, &block)
|
64
|
-
url_string = url_for(options)
|
65
|
-
|
66
|
-
if "/#{request.path.split('/')[1]}" == url_string
|
67
|
-
html_options[:class] = "#{html_options[:class]} current"
|
68
|
-
end
|
69
|
-
|
70
|
-
link_to(name, options, html_options, &block)
|
71
|
-
end
|
72
|
-
|
73
|
-
def page_id
|
74
|
-
name = 'page-' + request.path_parameters[:controller] + '-' + request.path_parameters[:action]
|
75
|
-
name.gsub!(/_+/, '-')
|
76
|
-
name
|
77
|
-
end
|
78
|
-
|
79
|
-
def link_to_website(url, html_options = {})
|
80
|
-
return nil if url.blank?
|
81
|
-
|
82
|
-
url = "http://#{url}" unless url =~ /^(ht|f)tps?:\/\//i
|
83
|
-
html_options[:href] = url
|
84
|
-
content_tag(:a, url, html_options)
|
85
|
-
end
|
86
|
-
|
87
|
-
# Create a named haml tag to wrap IE conditional around a block
|
88
|
-
# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
89
|
-
def ie_tag(name=:body, attrs={}, &block)
|
90
|
-
attrs.symbolize_keys!
|
91
|
-
result = "<!--[if lt IE 7 ]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->\n".html_safe
|
92
|
-
result += "<!--[if IE 7 ]> #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->\n".html_safe
|
93
|
-
result += "<!--[if IE 8 ]> #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->\n".html_safe
|
94
|
-
result += "<!--[if IE 9 ]> #{ tag(name, add_class('ie9', attrs), true) } <![endif]-->\n".html_safe
|
95
|
-
result += "<!--[if (gte IE 9)|!(IE)]><!-->".html_safe
|
96
|
-
|
97
|
-
result += content_tag name, attrs do
|
98
|
-
"<!--<![endif]-->\n".html_safe + with_output_buffer(&block)
|
99
|
-
end
|
100
|
-
|
101
|
-
result
|
102
|
-
end
|
103
|
-
|
104
|
-
def ie_html(attrs={}, &block)
|
105
|
-
ie_tag(:html, attrs, &block)
|
106
|
-
end
|
107
|
-
|
108
|
-
def ie_body(attrs={}, &block)
|
109
|
-
ie_tag(:body, attrs, &block)
|
110
|
-
end
|
111
|
-
|
112
|
-
def google_account_id
|
113
|
-
ENV['GOOGLE_ACCOUNT_ID'] || google_config(:google_account_id)
|
114
|
-
end
|
115
|
-
|
116
|
-
def google_api_key
|
117
|
-
ENV['GOOGLE_API_KEY'] || google_config(:google_api_key)
|
118
|
-
end
|
119
|
-
|
120
|
-
private
|
121
|
-
|
122
|
-
def add_class(name, attrs)
|
123
|
-
classes = attrs[:class] || ''
|
124
|
-
classes.strip!
|
125
|
-
classes = ' ' + classes if !classes.blank?
|
126
|
-
classes = name + classes
|
127
|
-
attrs.merge(:class => classes)
|
128
|
-
end
|
129
|
-
|
130
|
-
def google_config(key)
|
131
|
-
configs = YAML.load_file(File.join(Rails.root, 'config', 'google.yml'))[Rails.env.to_sym] rescue {}
|
132
|
-
configs[key]
|
133
|
-
end
|
134
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
flash_messages = ->
|
2
|
-
$ = document.id
|
3
|
-
|
4
|
-
document.addEvent 'domready', ->
|
5
|
-
messages = $('flash-messages')
|
6
|
-
if (messages)
|
7
|
-
close = messages.getElement('a')
|
8
|
-
hideMessages = -> messages.slide('out')
|
9
|
-
|
10
|
-
close.addEvent 'click', -> (e)
|
11
|
-
e.stop()
|
12
|
-
hideMessages()
|
13
|
-
|
14
|
-
hideMessages.delay(10000)
|
15
|
-
|
16
|
-
flash_messages()
|
File without changes
|
File without changes
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<%%= ie_html :class => 'no-js', :lang => :en do %>
|
3
|
-
|
4
|
-
<head>
|
5
|
-
<meta charset="utf-8">
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
7
|
-
<%%= csrf_meta_tag %>
|
8
|
-
|
9
|
-
<title><%%= page_title "Default title" %></title>
|
10
|
-
<meta name="description" content="<%%= yield :description %>">
|
11
|
-
<meta name="author" content="<%%= yield :author %>">
|
12
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
13
|
-
|
14
|
-
<link rel="shortcut icon" href="/favicon.ico">
|
15
|
-
</head>
|
16
|
-
<body id="<%%= page_id %>">
|
17
|
-
|
18
|
-
<div id="container">
|
19
|
-
<header>
|
20
|
-
<h1><%%= link_to_unless_current 'Welcome aboard!', root_path %></h1>
|
21
|
-
</header>
|
22
|
-
|
23
|
-
<div id="main">
|
24
|
-
<%%= flash_messages %>
|
25
|
-
|
26
|
-
<article class="article">
|
27
|
-
<%%= yield %>
|
28
|
-
</article>
|
29
|
-
|
30
|
-
<aside>
|
31
|
-
<%%= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar") %>
|
32
|
-
</aside>
|
33
|
-
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<footer>This application was generated with Playmo gem.</footer>
|
37
|
-
</div>
|
38
|
-
|
39
|
-
</body>
|
40
|
-
<%% end %>
|
File without changes
|