somatics3-generators 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -31,3 +31,5 @@ en:
31
31
  no_data_available: No Data Available
32
32
  Add: Add
33
33
  Cancel: Cancel
34
+ Sort_by_this_field: Sort by this field
35
+ sort_by: sort by {{field}}
@@ -30,4 +30,6 @@
30
30
  next: 下一頁
31
31
  no_data_available: 未有可用的資料
32
32
  Add: 加入
33
- Cancel: 取消
33
+ Cancel: 取消
34
+ Sort_by_this_field: 以此列排序
35
+ sort_by: sort by {{field}}
@@ -4,9 +4,6 @@
4
4
  class Admin::AdminController < ActionController::Base
5
5
  helper :all # include all helpers, all the time
6
6
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
-
8
- # Scrub sensitive parameters from your log
9
- filter_parameter_logging :password
10
7
 
11
8
  include RedmineFilter
12
9
  include UserAuthenticatedSystem
@@ -19,24 +19,19 @@ module Admin::AdminHelper
19
19
  end
20
20
 
21
21
  def sort_asc_desc_helper(model_name, param)
22
- result = image_tag('admin/sort_asc.png') if params[:"#{model_name}_sort"] == param
23
- result = image_tag('admin/sort_desc.png') if params[:"#{model_name}_sort"] == param + "_reverse"
22
+ result = image_tag('somatics/sort_asc.png') if params[:"#{model_name}_sort"] == param
23
+ result = image_tag('somatics/sort_desc.png') if params[:"#{model_name}_sort"] == param + "_reverse"
24
24
  return result || ''
25
25
  end
26
26
 
27
27
  def sort_link_helper(text, model_name ,param)
28
28
  key = param
29
29
  key += "_reverse" if params[:"#{model_name}_sort"] == param
30
- options = {
31
- :url => {:action => 'index', :params => params.merge({:"#{model_name}_sort" => key, :page => nil})},
32
- :update => 'content',
33
- :method => :get
34
- }
35
30
  html_options = {
36
- :title => "Sort by this field",
37
- :href => url_for(:action => 'index', :params => params.merge({:"#{model_name}_sort" => key, :page => nil}))
31
+ :title => I18n.t("sort_by",:field => text),
32
+ :remote=>true
38
33
  }
39
- link_to(text + sort_asc_desc_helper(model_name,param), options, html_options,:remote=>true)
34
+ link_to(text, params.merge({:"#{model_name}_sort" => key}), html_options) + sort_asc_desc_helper(model_name,param)
40
35
  end
41
36
 
42
37
  def operators_for_select(filter_type)
@@ -6,18 +6,17 @@
6
6
 
7
7
  <%%= stylesheet_link_tag 'somatics/base', 'somatics/jstoolbar', :media => 'all' %>
8
8
  <%%#= stylesheet_link_tag 'somatics/context_menu', :media => 'all' %>
9
+
9
10
  <!--[if IE]>
10
11
  <style type="text/css">
11
12
  * html body{ width: expression( document.documentElement.clientWidth < 900 ? '900px' : '100%' ); }
12
13
  body {behavior: url(/stylesheets/somatics/csshover.htc);}
13
14
  </style>
14
15
  <![endif]-->
16
+
17
+ <%%= javascript_include_tag 'somatics/prototype.js', "rails", 'somatics/effects.js', 'somatics/dragdrop.js', 'somatics/controls.js','somatics/base.js','somatics/select_list_move.js','somatics/context_menu.js' %>
18
+ <%%= csrf_meta_tag %>
15
19
 
16
- <%%= javascript_include_tag 'somatics/prototype.js', 'somatics/effects.js', 'somatics/dragdrop.js', 'somatics/controls.js','somatics/base.js','somatics/select_list_move.js','somatics/context_menu.js' %>
17
- <!--
18
- <link href="http://www.redmine.org/issues.atom?query_id=" rel="alternate" title="Issues" type="application/atom+xml" />
19
- <link href="http://www.redmine.org/issues/changes?format=atom&amp;query_id=" rel="alternate" title="Details of all changes" type="application/atom+xml" />
20
- -->
21
20
  <%%= init_tinymce_hammer_if_required %>
22
21
  </head>
23
22
  <body>
@@ -1,16 +1,5 @@
1
1
  class SomaticLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer
2
2
 
3
- def to_html
4
- links = @options[:page_links] ? windowed_links : []
5
- # previous/next buttons
6
- links.unshift page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label])
7
- links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label])
8
-
9
- html = links.join(@options[:separator])
10
- html += "( #{@collection.offset+1}-#{@collection.offset + @collection.per_page}/#{@collection.total_entries} )"
11
- @options[:container] ? @template.content_tag(:p, html, html_attributes) : html
12
- end
13
-
14
3
  def prepare(collection, options, template)
15
4
  super
16
5
  @collection_name = template.controller.controller_name
@@ -19,24 +8,17 @@ class SomaticLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer
19
8
  @options[:next_label] = I18n.t(:next)
20
9
  end
21
10
 
22
- protected
23
-
24
- def page_link(page, text, attributes = {})
25
- # @template.content_tag(:li, @template.link_to(text, url_for(page)), attributes)
26
- # @template.link_to(text, url_for(page), attributes)
27
- @template.link_to(text,{
28
- :url => url_for(page),
29
- :update => 'content',
30
- :method => :get
31
- },attributes.merge({
32
- :href => url_for(page)
33
- }),:remote=>true
34
- )
11
+ private
12
+
13
+ def link(text, target, attributes = {})
14
+ if target.is_a? Fixnum
15
+ attributes[:rel] = rel_value(target)
16
+ target = url(target)
17
+ end
18
+ attributes[:href] = target
19
+ # tag(:a, text, attributes)
20
+ @template.link_to(text,target, attributes.merge({:remote => true}))
35
21
  end
36
22
 
37
- def page_span(page, text, attributes = {})
38
- # @template.content_tag(:li, text, attributes)
39
- @template.content_tag(:span, text, attributes)
40
- end
41
23
 
42
24
  end
@@ -226,6 +226,12 @@ Event.observe(window, 'load', function() {
226
226
  });
227
227
  });
228
228
 
229
+ Event.observe(window, "ajax:complete", function(event){
230
+ if(event.memo.responseText != 'undefined'){
231
+ $("content").update(event.memo.responseText); // insert content
232
+ }
233
+ });
234
+
229
235
  function link_to(url) {
230
236
  window.location = url;
231
237
  }
@@ -2,16 +2,10 @@
2
2
  <thead>
3
3
  <tr>
4
4
  <!-- <th><%%#= link_to image_tag('toggle_check.png', :alt => "Toggle_check"), admin_<%= plural_name %>_path, :onclick => "toggleIssuesSelection(Element.up(this, &quot;form&quot;)); return false;", :title => "Check all/Uncheck all" %></th> -->
5
- <th title="Sort by &quot;#&quot;"><%%= sort_link_helper t('ID'), '<%=singular_name%>', 'id' %></th>
6
- <% if options[:admin_authenticated] || options[:authenticated] -%>
7
- <th title="Sort by &quot;Login&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:login), '<%=singular_name%>', 'login' %></th>
8
- <th title="Sort by &quot;Name&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:name), '<%=singular_name%>', 'name' %></th>
9
- <th title="Sort by &quot;Email&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:email), '<%=singular_name%>', 'email' %></th>
10
- <th title="Sort by &quot;Created At&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:created_at), '<%=singular_name%>', 'created_at' %></th>
11
- <% end -%>
12
- <% for attribute in attributes -%>
13
- <th title="Sort by &quot;<%= attribute.name.humanize %>&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:<%= attribute.name %>), '<%=singular_name%>', '<%= attribute.name %>' %></th>
14
- <% end -%>
5
+ <th title="<%%=t "sort_by", :field => '#'%>"><%%= sort_link_helper t('ID'), '<%=singular_name%>', 'id' %></th>
6
+ <% for attribute in attributes -%>
7
+ <th title="<%%=t "sort_by", :field => <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %>"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:<%= attribute.name %>), '<%=singular_name%>', '<%= attribute.name %>' %></th>
8
+ <% end -%>
15
9
  <!-- More Sort Link Helper -->
16
10
  </tr>
17
11
  </thead>
@@ -21,15 +15,9 @@
21
15
  <tr id="<%% dom_id(<%=singular_name%>)%>" class="hascontextmenu <%%= cycle 'odd' , 'even' %> issue">
22
16
  <!-- <td class="checkbox"><input name="ids[]" type="checkbox" value="<%%#= <%=singular_name%>.id %>" /></td> -->
23
17
  <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);"><%%= link_to <%= singular_name %>.id, [:admin, <%= singular_name %>]%></td>
24
- <% if options[:admin_authenticated] || options[:authenticated] -%>
25
- <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="login"><%%=h <%= singular_name %>.login %></td>
26
- <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="name"><%%=h <%= singular_name %>.name %></td>
27
- <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="email"><%%=h <%= singular_name %>.email %></td>
28
- <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="created_at"><%%=h <%= singular_name %>.created_at %></td>
29
- <% end -%>
30
- <% for attribute in attributes -%>
18
+ <% for attribute in attributes -%>
31
19
  <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="<%= attribute.name %>"><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
32
- <% end -%>
20
+ <% end -%>
33
21
  <!-- More Fields -->
34
22
  </tr>
35
23
  <%% end %>
@@ -24,5 +24,5 @@
24
24
 
25
25
  <%% content_for :sidebar do %>
26
26
  <h3>Actions</h3>
27
- <%%= link_to "#{t('new')} #{<%= class_name %>.model_name.human}", new_admin_<%= singular_name %>_path %>
27
+ <%%= link_to "#{t('New')} #{<%= class_name %>.model_name.human}", new_admin_<%= singular_name %>_path %>
28
28
  <%% end %>
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{somatics3-generators}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Benjamin Wong"]
@@ -1,12 +1,10 @@
1
1
  # somatics.rb
2
-
3
- # app_name = ask 'Type your Application Name for the Heroku project, followed by [ENTER]:'
4
2
  #
5
3
  # repo_entered = ask 'Type your repository for the project (SVN), followed by [ENTER]:'
6
4
 
7
5
  gem 'will_paginate', :version => "~> 3.0.pre2"
8
6
  gem 'prawn', :version => '0.6.3'
9
- gem 'somatics3-generators'
7
+ gem 'somatics3-generators', :group => :development
10
8
  gem 'json'
11
9
 
12
10
  plugin 'action_mailer_optional_tls',
@@ -35,57 +33,57 @@ plugin 'dynamic_form',
35
33
 
36
34
  rakefile "setup_svn.rake" do
37
35
  <<-TASK
38
- desc "Configure Subversion for Rails"
39
- task :setup_svn do
40
- system "svn info"
41
- if $? != 0
42
- puts 'Please Import your project to svn before executing this task'
43
- exit(0)
44
- end
45
-
46
- system "svn commit -m 'initial commit'"
47
-
48
- puts "Add .gems"
49
- system "svn add .gems"
50
- system "svn commit -m 'add .gems'"
51
-
52
- puts "Add .gitignore"
53
- system "echo '.svn' > .gitignore"
54
- system "svn add .gitignore"
55
- system "svn commit -m 'add .gitignore'"
56
-
57
- puts "Ignoring .git"
58
- system "svn propset svn:ignore '.git' ."
59
-
60
- puts "Removing /log"
61
- system "svn remove log/*"
62
- system "svn commit -m 'removing all log files from subversion'"
63
- system 'svn propset svn:ignore "*.log" log/'
64
- system "svn update log/"
65
- system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
66
-
67
- puts "Ignoring /db"
68
- system 'svn propset svn:ignore "*.db" db/'
69
- system "svn update db/"
70
- system "svn commit -m 'Ignoring all files in /db/ ending in .db'"
71
-
72
- puts "Renaming database.yml database.example"
73
- system "svn move config/database.yml config/database.example"
74
- system "svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'"
75
- system 'svn propset svn:ignore "database.yml" config/'
76
- system "svn update config/"
77
- system "svn commit -m 'Ignoring database.yml'"
78
-
79
- puts "Ignoring /tmp"
80
- system 'svn propset svn:ignore "*" tmp/'
81
- system "svn update tmp/"
82
- system "svn commit -m 'Ignoring all files in /tmp/'"
83
-
84
- puts "Ignoring /doc"
85
- system 'svn propset svn:ignore "*" doc/'
86
- system "svn update doc/"
87
- system "svn commit -m 'Ignoring all files in /doc/'"
36
+ desc "Configure Subversion for Rails"
37
+ task :setup_svn do
38
+ system "svn info"
39
+ if $? != 0
40
+ puts 'Please Import your project to svn before executing this task'
41
+ exit(0)
88
42
  end
43
+
44
+ system "svn commit -m 'initial commit'"
45
+
46
+ puts "Add .gems"
47
+ system "svn add .gems"
48
+ system "svn commit -m 'add .gems'"
49
+
50
+ puts "Add .gitignore"
51
+ system "echo '.svn' > .gitignore"
52
+ system "svn add .gitignore"
53
+ system "svn commit -m 'add .gitignore'"
54
+
55
+ puts "Ignoring .git"
56
+ system "svn propset svn:ignore '.git' ."
57
+
58
+ puts "Removing /log"
59
+ system "svn remove log/*"
60
+ system "svn commit -m 'removing all log files from subversion'"
61
+ system 'svn propset svn:ignore "*.log" log/'
62
+ system "svn update log/"
63
+ system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
64
+
65
+ puts "Ignoring /db"
66
+ system 'svn propset svn:ignore "*.db" db/'
67
+ system "svn update db/"
68
+ system "svn commit -m 'Ignoring all files in /db/ ending in .db'"
69
+
70
+ puts "Renaming database.yml database.example"
71
+ system "svn move config/database.yml config/database.example"
72
+ system "svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'"
73
+ system 'svn propset svn:ignore "database.yml" config/'
74
+ system "svn update config/"
75
+ system "svn commit -m 'Ignoring database.yml'"
76
+
77
+ puts "Ignoring /tmp"
78
+ system 'svn propset svn:ignore "*" tmp/'
79
+ system "svn update tmp/"
80
+ system "svn commit -m 'Ignoring all files in /tmp/'"
81
+
82
+ puts "Ignoring /doc"
83
+ system 'svn propset svn:ignore "*" doc/'
84
+ system "svn update doc/"
85
+ system "svn commit -m 'Ignoring all files in /doc/'"
86
+ end
89
87
  TASK
90
88
  end
91
89
 
@@ -101,28 +99,53 @@ generate "somatics:settings"
101
99
  rake "db:create"
102
100
  rake "db:migrate"
103
101
 
104
- rake "somatics:create_user" if yes?(%(Create Default Admin User (username:admin, password:somatics)?))
105
-
106
-
107
- # unless app_name.blank?
108
- # run "git init"
109
- # rake "heroku:gems"
110
- # run "heroku create #{app_name}"
111
- # run "git add ."
112
- # run "git commit -a -m 'Initial Commit' "
113
- # run "heroku addons:add cron:daily"
114
- # run "heroku addons:add deployhooks:email \
115
- # recipient=heroku@inspiresynergy.com \
116
- # subject=\"#{app_name} Deployed\" \
117
- # body=\"{{user}} deployed app\""
118
- # run "heroku addons:add piggyback_ssl"
119
- # run "heroku addons:add newrelic:bronze"
120
- # run "heroku addons:add cron:daily"
121
- # run "git push heroku master"
122
- # run "heroku rake db:migrate"
123
- # end
124
- #
125
- # unless repo_entered.blank?
126
- # run "svn co #{repo_entered}"
127
- # rake "setup_svn"
128
- # end
102
+ if yes?(%(Create Default Admin User (username:admin, password:somatics)?))
103
+ rake "somatics:create_user"
104
+ else
105
+ puts "You can run rake somatics:create_user to create default user"
106
+ end
107
+
108
+ # Delete unnecessary files
109
+ run "rm README"
110
+ # run "rm public/index.html"
111
+
112
+ app_name = ARGV[0]
113
+
114
+ # Commit all work so far to the local repository
115
+ git :init
116
+ git :add => '.'
117
+ git :commit => "-a -m 'Initial commit'"
118
+
119
+ rakefile "heroku.rake" do
120
+ <<-TASK
121
+ namespace :heroku do
122
+ desc "Configure Heroku"
123
+ task :setup do
124
+ system "heroku create #{app_name}"
125
+ system "git add ."
126
+ system "git commit -a -m 'Initial Commit'"
127
+ # system "heroku addons:add cron:daily"
128
+ system "heroku addons:add deployhooks:email \
129
+ recipient=heroku@inspiresynergy.com \
130
+ subject='[#{app_name}] Deployed' \
131
+ body='{{user}} deployed #{app_name} successfully'"
132
+ system "heroku addons:add piggyback_ssl"
133
+ system "heroku addons:add newrelic:bronze"
134
+ end
135
+
136
+ desc "Deploy to Heroku"
137
+ task :deploy do
138
+ system "git add ."
139
+ system "git commit -a -m 'Heroku Release'"
140
+ system "git push heroku master"
141
+ end
142
+
143
+ desc "Deploy and Migrate to Heroku"
144
+ task :deploy_migrate => :deploy do
145
+ system "heroku rake db:migrate"
146
+ end
147
+
148
+ end
149
+ TASK
150
+ end
151
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: somatics3-generators
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Wong