railj 0.0.2 → 0.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,13 @@
1
- h1. Railj
1
+ !http://github.com/kossnocorp/railj/raw/master/doc/images/logo.png!
2
2
 
3
- Hello cruel world!
3
+ h1. What is Railj?
4
+
5
+ Railj is delicious Porno with Rails and JavaScript in leading roles. Never before Ruby on Rails and JavaScript were not so close.
6
+
7
+ h1. Common information
8
+
9
+ * "Description":http://wiki.github.com/kossnocorp/railj/readme
10
+ * "Roadmap":http://wiki.github.com/kossnocorp/railj/roadmap
11
+ * "Changelog":http://wiki.github.com/kossnocorp/railj/changelog
12
+ * "License":http://wiki.github.com/kossnocorp/railj/license
4
13
 
5
- h1. "License":http://github.com/kossnocorp/railj/blob/master/LICENSE.textile
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "kossnocorp@gmail.com"
11
11
  gem.homepage = "http://github.com/kossnocorp/railj"
12
12
  gem.authors = ["Aleksandr Koss"]
13
- gem.version = '0.0.2'
13
+ gem.version = '0.0.2.1'
14
14
 
15
15
  Jeweler::GemcutterTasks.new
16
16
 
Binary file
@@ -15,7 +15,7 @@ $(function() {
15
15
  'style="border:0;margin:3px;position:absolute;top:0;left:0;"' +
16
16
  '/>';
17
17
 
18
- object.wrap('<div style="position: relative;"></div>');
18
+ object.wrap('<div style="display:inline-block;position:relative;"></div>');
19
19
 
20
20
  function destroy_default_object() {
21
21
  if(default_object == null) return;
@@ -5,7 +5,7 @@ module Railj
5
5
 
6
6
  #
7
7
 
8
- alias railsjs__defaulted_text_field text_field
8
+ alias railj__defaulted_text_field text_field
9
9
 
10
10
  def text_field object_name, method = nil, options = {}
11
11
 
@@ -18,20 +18,20 @@ module Railj
18
18
  method_copy['placeholder'] = default_value
19
19
  end
20
20
 
21
- railsjs__defaulted_text_field \
21
+ railj__defaulted_text_field \
22
22
  object_name, method_copy
23
23
  elsif method
24
- railsjs__defaulted_text_field \
24
+ railj__defaulted_text_field \
25
25
  object_name, method, options
26
26
  else
27
- railsjs__defaulted_text_field \
27
+ railj__defaulted_text_field \
28
28
  object_name, {}
29
29
  end
30
30
  end
31
31
 
32
32
  #
33
33
 
34
- alias railsjs__defaulted_password_field password_field
34
+ alias railj__defaulted_password_field password_field
35
35
 
36
36
  def password_field object_name, method = nil, options = {}
37
37
 
@@ -44,15 +44,15 @@ module Railj
44
44
  method_copy['placeholder'] = default_value
45
45
  end
46
46
 
47
- railsjs__defaulted_password_field \
47
+ railj__defaulted_password_field \
48
48
  object_name, method_copy
49
49
  elsif method
50
50
  debugger
51
51
 
52
- railsjs__defaulted_password_field \
52
+ railj__defaulted_password_field \
53
53
  object_name, method, options
54
54
  else
55
- railsjs__defaulted_password_field \
55
+ railj__defaulted_password_field \
56
56
  object_name, {}
57
57
  end
58
58
  end
@@ -0,0 +1,43 @@
1
+ module Railj
2
+ module Editable
3
+ def self.included base
4
+ base.class_eval do
5
+ def method_missing method, *args, &block
6
+ if editable_data =
7
+ method.to_s.match(/editable_([^_]+){0,1}_?(if){0,1}/)
8
+
9
+ html_tag, check_if = editable_data[1..2]
10
+
11
+ if check_if
12
+ check_result, model_instance, model_field = args
13
+ else
14
+ model_instance, model_field = args
15
+ end
16
+
17
+ html = (field_value = model_instance.send model_field.to_s)
18
+
19
+ if block_given?
20
+ if check_result
21
+ html = capture field_value, check_result, &block
22
+ else
23
+ html = capture field_value, &block
24
+ end
25
+ end
26
+
27
+ debugger
28
+
29
+ concat(content_tag \
30
+ html_tag.to_sym,
31
+ html#, {}
32
+ )
33
+ else
34
+ super method, *args
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ ActionView::Base.class_eval { include Railj::Editable }
43
+
@@ -1,7 +1,14 @@
1
+ # Middlewares
2
+
1
3
  require 'i18n/i18n'
2
4
  require 'routes/routes'
3
5
 
6
+ # Helpers
7
+
4
8
  require 'helpers/defaulted'
9
+ require 'helpers/editable'
10
+
11
+ #
5
12
 
6
13
  require 'validations/validations'
7
14
  require 'validations/form_helper'
@@ -10,8 +10,12 @@ module Railj
10
10
 
11
11
  def call env
12
12
  if env['PATH_INFO'] =~ /^\/javascripts\/routes.js$/
13
+
13
14
  response = rails_route_function
14
15
 
16
+ # named_routes = []
17
+ # routes_list = []
18
+
15
19
  routes = ActionController::Routing::Routes.routes.collect do |route|
16
20
  host = "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}"
17
21
 
@@ -21,9 +25,30 @@ module Railj
21
25
  named_routes.routes.index(route).to_s
22
26
 
23
27
  if named_route != ''
28
+
29
+ #named_routes << named_route
30
+
24
31
  response << route_function("#{named_route}_path", path)
25
32
  response << route_function("#{named_route}_url", host + path)
33
+ #else
34
+ # string_string = <<EOF
35
+ #********************************************************
36
+ #{route.conditions[:method].to_s.upcase}
37
+ #{route.segments.inject("") { |str,s| str << s.to_s }}
38
+ #{route.requirements.empty? ? "" : route.requirements.inspect}
39
+ #********************************************************
40
+ #EOF
41
+ # response << string_string
26
42
  end
43
+
44
+ #response <<
45
+ # "<li>#{ActionController::Routing::Routes.named_routes.routes.index(route).to_s} *** #{route.conditions[:method].to_s.upcase} *** #{route.segments.inject("") { |str,s| str << s.to_s }} *** #{route.requirements.empty? ? "" : route.requirements.inspect}</li>"
46
+
47
+ #name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
48
+ #verb = route.conditions[:method].to_s.upcase
49
+ #segs = route.segments.inject("") { |str,s| str << s.to_s }
50
+ #reqs = route.requirements.empty? ? "" : route.requirements.inspect
51
+ #{:name => name, :verb => verb, :segs => segs, :reqs => reqs}
27
52
  end
28
53
 
29
54
  [200, {'Content-Type' => 'application/javascript'}, [response]]
@@ -65,6 +90,13 @@ function #{name}(variables) {
65
90
  }
66
91
  EOF
67
92
  end
93
+
94
+ # def route_for routes_list #requirements
95
+ #<<EOF
96
+ #function url_for(variables) {
97
+ #}
98
+ #EOF
99
+ # end
68
100
  end
69
101
  end
70
102
  end
@@ -5,28 +5,28 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{railj}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aleksandr Koss"]
12
- s.date = %q{2009-11-16}
12
+ s.date = %q{2009-11-24}
13
13
  s.description = %q{Porno with Rails and JavaScript in leading roles}
14
14
  s.email = %q{kossnocorp@gmail.com}
15
15
  s.extra_rdoc_files = [
16
- "LICENSE.textile",
17
- "README.textile"
16
+ "README.textile"
18
17
  ]
19
18
  s.files = [
20
19
  ".gitignore",
21
- "LICENSE.textile",
22
20
  "README.textile",
23
21
  "Rakefile",
24
22
  "doc/images/defaulted_screenshot.png",
23
+ "doc/images/logo.png",
25
24
  "generators/railj_defaulted/railj_defaulted_generator.rb",
26
25
  "generators/railj_defaulted/templates/jquery.defaulted.js",
27
26
  "init.rb",
28
27
  "install.rb",
29
28
  "lib/helpers/defaulted.rb",
29
+ "lib/helpers/editable.rb",
30
30
  "lib/i18n/i18n.rb",
31
31
  "lib/railj.rb",
32
32
  "lib/routes/routes.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksandr Koss
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-16 00:00:00 +06:00
12
+ date: 2009-11-24 00:00:00 +06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,19 +20,19 @@ executables: []
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - LICENSE.textile
24
23
  - README.textile
25
24
  files:
26
25
  - .gitignore
27
- - LICENSE.textile
28
26
  - README.textile
29
27
  - Rakefile
30
28
  - doc/images/defaulted_screenshot.png
29
+ - doc/images/logo.png
31
30
  - generators/railj_defaulted/railj_defaulted_generator.rb
32
31
  - generators/railj_defaulted/templates/jquery.defaulted.js
33
32
  - init.rb
34
33
  - install.rb
35
34
  - lib/helpers/defaulted.rb
35
+ - lib/helpers/editable.rb
36
36
  - lib/i18n/i18n.rb
37
37
  - lib/railj.rb
38
38
  - lib/routes/routes.rb
@@ -1,5 +0,0 @@
1
- Copyright (c) 2009 Aleksandr Koss <kossnocorp@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4
-
5
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.