sunrise-core 0.1.1 → 0.1.2
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/README.rdoc +2 -2
- data/app/controllers/manage/assets_controller.rb +2 -2
- data/app/views/layouts/manage.html.erb +4 -5
- data/app/views/manage/{assets/_picture.html.erb → fileupload/_asset.html.erb} +4 -3
- data/app/views/manage/fileupload/_container.html.erb +25 -0
- data/app/views/manage/fileupload/_tmpl.html.erb +14 -0
- data/app/views/manage/users/_form.html.erb +5 -1
- data/app/views/manage/users/_model_filter.html.erb +5 -3
- data/config/locales/manage/en.yml +5 -0
- data/config/locales/manage/ru.yml +5 -0
- data/config/locales/manage/uk.yml +5 -0
- data/lib/generators/sunrise/install_generator.rb +26 -6
- data/lib/generators/sunrise/templates/helpers/manage/assets_helper.rb +0 -14
- data/lib/generators/sunrise/templates/javascripts/manage-fileuploader.js +182 -0
- data/lib/generators/sunrise/templates/javascripts/manage.js +17 -13
- data/lib/generators/sunrise/templates/models/defaults/user.rb +1 -5
- data/lib/generators/sunrise/templates/stylesheets/manage/buttons.css +42 -0
- data/lib/generators/sunrise/templates/stylesheets/manage/main.css +11 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/{jquery-ui-1.8.6.custom.css → jquery-ui-1.8.13.custom.css} +37 -31
- data/lib/sunrise/engine.rb +5 -0
- data/lib/sunrise/models/asset.rb +1 -1
- data/lib/sunrise/version.rb +1 -1
- data/lib/sunrise/views/form_builder.rb +53 -6
- metadata +56 -43
- data/app/views/manage/assets/_collection.html.erb +0 -32
- data/app/views/manage/assets/_swfscript.html.erb +0 -51
- data/lib/generators/sunrise/templates/javascripts/swfupload/fileprogress.js +0 -114
- data/lib/generators/sunrise/templates/javascripts/swfupload/handlers.js +0 -164
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.js +0 -1134
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.queue.js +0 -98
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.swf +0 -0
data/README.rdoc
CHANGED
@@ -33,9 +33,9 @@ Generate simple_form configurations:
|
|
33
33
|
|
34
34
|
rails generate simple_form:install
|
35
35
|
|
36
|
-
Generate
|
36
|
+
Generate file uploads assets:
|
37
37
|
|
38
|
-
rails generate
|
38
|
+
rails generate sunrise:file_upload:install
|
39
39
|
|
40
40
|
Migrate database:
|
41
41
|
|
@@ -31,7 +31,7 @@ class Manage::AssetsController < Manage::BaseController
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def sort
|
34
|
-
params[:
|
34
|
+
params[:asset].each_with_index do |id, index|
|
35
35
|
@klass.move_to(index, id)
|
36
36
|
end
|
37
37
|
|
@@ -64,7 +64,7 @@ class Manage::AssetsController < Manage::BaseController
|
|
64
64
|
@klass = params[:klass].blank? ? Asset : params[:klass].classify.constantize
|
65
65
|
|
66
66
|
if params[:collection].blank?
|
67
|
-
@asset = @klass.
|
67
|
+
@asset = @klass.where([c_names.join(' AND ')] + c_values).first
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -4,23 +4,21 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
5
|
<%= csrf_meta_tag %>
|
6
6
|
<title><%= t('manage.page_title') %></title>
|
7
|
-
<%= stylesheet_link_tag "manage/main", "fancybox/jquery.fancybox-1.3.4" %>
|
8
|
-
<%= stylesheet_link_tag "smoothness/jquery-ui-1.8.
|
7
|
+
<%= stylesheet_link_tag "manage/main", "manage/buttons", "fancybox/jquery.fancybox-1.3.4" %>
|
8
|
+
<%= stylesheet_link_tag "smoothness/jquery-ui-1.8.13.custom" %>
|
9
9
|
<!--[if lt IE 7]><%= stylesheet_link_tag "manage/ie" %><![endif]-->
|
10
10
|
|
11
11
|
<script src="https://www.google.com/jsapi?key=" type="text/javascript"></script>
|
12
12
|
<script language="Javascript" type="text/javascript">
|
13
13
|
//<![CDATA[
|
14
14
|
google.load("jquery", "1.5.1");
|
15
|
-
google.load("jqueryui", "1.8.
|
16
|
-
google.load("swfobject", "2.2");
|
15
|
+
google.load("jqueryui", "1.8.13");
|
17
16
|
//]]>
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<%= javascript_include_tag "jquery.tmpl.min", "jquery.fancybox-1.3.4.pack", "jquery.cookie" %>
|
21
20
|
<%= javascript_include_tag "jquery-ui-timepicker-addon", "datepicker/jquery.ui.datepicker-#{I18n.locale}" %>
|
22
21
|
<%= javascript_include_tag :ckeditor, "preloader", "rails", "manage" %>
|
23
|
-
<%= attach_include_files %>
|
24
22
|
<%= yield(:head)%>
|
25
23
|
</head>
|
26
24
|
<body>
|
@@ -36,5 +34,6 @@
|
|
36
34
|
</div>
|
37
35
|
</div>
|
38
36
|
<%= yield(:footer) %>
|
37
|
+
<%= render :partial => 'manage/fileupload/tmpl' %>
|
39
38
|
</body>
|
40
39
|
</html>
|
@@ -1,10 +1,11 @@
|
|
1
|
-
<%= content_tag(:div, :class=>"asset ill", :id =>
|
1
|
+
<%= content_tag(:div, :class => "asset ill", :id => "asset_#{asset.id}") do %>
|
2
2
|
<%= link_to image_tag("manage/empty.gif", :alt=>t('manage.delete'), :title=>t('manage.delete')),
|
3
|
-
manage_asset_path(
|
3
|
+
manage_asset_path(asset),
|
4
4
|
:remote => true,
|
5
5
|
:method => :delete,
|
6
6
|
:confirm => t('manage.confirm_delete'),
|
7
7
|
:class => "del" %>
|
8
8
|
|
9
|
-
<%= link_to image_tag(
|
9
|
+
<%= link_to image_tag(asset.url(:thumb), :title => asset.filename, :width => 80, :height => 80),
|
10
|
+
asset.url, :class => "fancybox" %>
|
10
11
|
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= content_tag(:div, :class => 'fileupload', :id => element_id) do %>
|
2
|
+
<div class="gray-blocks">
|
3
|
+
<div class="bg-bl">
|
4
|
+
<div class="gr-title"><%= label %></div>
|
5
|
+
<div class="fileupload-list ill-bl galery">
|
6
|
+
<%= render :partial => 'manage/fileupload/asset', :collection => assets %>
|
7
|
+
</div>
|
8
|
+
<div class="file-types">
|
9
|
+
<span class="fileupload-button">
|
10
|
+
<button type="button" class="cupid-green"><%= t('manage.fileupload.button') %></button>
|
11
|
+
</span>
|
12
|
+
<div class="type-info">
|
13
|
+
<span><%= file_title %>. <%= t('manage.fileupload.max_size') %>:</span><strong><%= file_max_size %> MB</strong>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= javascript_tag :language => "Javascript" do -%>
|
21
|
+
$(document).ready(function(){
|
22
|
+
new qq.FileUploaderInput(<%=raw script_options %>);
|
23
|
+
Manage.init_assets('<%= element_id %>', '<%= sort_manage_assets_path(:klass=>asset_klass) %>', <%= multiple ? 'true' : 'false' %>);
|
24
|
+
});
|
25
|
+
<% end -%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<script id="fileupload_tmpl" type="text/x-jquery-tmpl">
|
2
|
+
<div class="asset ill" id="asset_${id}">
|
3
|
+
<%= link_to image_tag("manage/empty.gif", :alt=>t('manage.delete'), :title=>t('manage.delete')),
|
4
|
+
"/manage/assets/${id}",
|
5
|
+
:remote => true,
|
6
|
+
:method => :delete,
|
7
|
+
:confirm => t('manage.confirm_delete'),
|
8
|
+
:class => "fileupload-cancel del" %>
|
9
|
+
|
10
|
+
<a href="${url}" class="fileupload-file fancybox">
|
11
|
+
<img width="80" height="80" src="${thumb_url}" title="${filename}">
|
12
|
+
</a>
|
13
|
+
</div>
|
14
|
+
</script>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<% javascript "fileupload/fileuploader.js", "manage-fileuploader.js" %>
|
2
|
+
|
1
3
|
<%= manage_form_for @user do |f| %>
|
2
4
|
<div class="edit-cont">
|
3
5
|
<div class="inputs-bl">
|
@@ -8,7 +10,9 @@
|
|
8
10
|
<%= f.input :role_type_id, :collection => RoleType.all %>
|
9
11
|
</div>
|
10
12
|
|
11
|
-
<%= f.attach_file_field :avatar, :
|
13
|
+
<%= f.attach_file_field :avatar, :file_max_size => 1 %>
|
14
|
+
|
15
|
+
<%= f.hidden_field :fileupload_guid if f.object.new_record? %>
|
12
16
|
</div>
|
13
17
|
|
14
18
|
<%= f.button :submit %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= link_to_function t('manage.model_filter.title'), "Manage.toggle_element('block_filter')", :class=>"dark-arr" %>
|
4
4
|
|
5
5
|
<%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
6
|
-
<%= form_for @search, :as => :search, :url=>manage_users_path, :html=>{:method=>:get
|
6
|
+
<%= form_for @search, :as => :search, :url=>manage_users_path, :html=>{:method=>:get} do |f| %>
|
7
7
|
<%= f.label :email, t('activerecord.attributes.user.email') %>
|
8
8
|
<%= f.text_field :email, :class=>"text" %>
|
9
9
|
|
@@ -11,8 +11,10 @@
|
|
11
11
|
<%= f.text_field :name, :class=>"text" %>
|
12
12
|
|
13
13
|
<div class="buts">
|
14
|
-
<%=
|
15
|
-
|
14
|
+
<%= content_tag(:button, :value => "search", :type => "submit", :name => "commit", :class => "gr cupid-green") do %>
|
15
|
+
<%= t('manage.model_filter.search') %>
|
16
|
+
<% end %>
|
17
|
+
|
16
18
|
<%= link_to t('manage.model_filter.clear'), manage_users_path, :class=>"erase" %>
|
17
19
|
</div>
|
18
20
|
<% end %>
|
@@ -11,6 +11,7 @@ en:
|
|
11
11
|
city_name: "City"
|
12
12
|
about: "About"
|
13
13
|
remember_me: "Remember me"
|
14
|
+
role_type_id: "Role type"
|
14
15
|
|
15
16
|
structure:
|
16
17
|
title: "Name"
|
@@ -213,6 +214,10 @@ en:
|
|
213
214
|
position_asc: "for the position of the ascending"
|
214
215
|
sort_order_desc: "to sort in descending order"
|
215
216
|
sort_order_asc: "to sort in ascending order"
|
217
|
+
|
218
|
+
fileupload:
|
219
|
+
button: "Select file"
|
220
|
+
max_size: "Max size"
|
216
221
|
|
217
222
|
flash:
|
218
223
|
manage:
|
@@ -11,6 +11,7 @@ ru:
|
|
11
11
|
city_name: "Город"
|
12
12
|
about: "О себе"
|
13
13
|
remember_me: "Запомнить меня"
|
14
|
+
role_type_id: "Тип пользователя"
|
14
15
|
|
15
16
|
structure:
|
16
17
|
title: "Название"
|
@@ -213,6 +214,10 @@ ru:
|
|
213
214
|
position_asc: "за позицией по возрастанию"
|
214
215
|
sort_order_desc: "по сортировке по убыванию"
|
215
216
|
sort_order_asc: "по сортировке по возрастанию"
|
217
|
+
|
218
|
+
fileupload:
|
219
|
+
button: "Выберите файл"
|
220
|
+
max_size: "Макс. р."
|
216
221
|
|
217
222
|
flash:
|
218
223
|
manage:
|
@@ -11,6 +11,7 @@ uk:
|
|
11
11
|
city_name: "Місто"
|
12
12
|
about: "Про себе"
|
13
13
|
remember_me: "Запам'ятати мене"
|
14
|
+
role_type_id: "Тип користувача"
|
14
15
|
|
15
16
|
structure:
|
16
17
|
title: "Назва"
|
@@ -213,6 +214,10 @@ uk:
|
|
213
214
|
position_asc: "за позицією за зростанням"
|
214
215
|
sort_order_desc: "по сортуванню за спаданням"
|
215
216
|
sort_order_asc: "по сортуванню за зростанням"
|
217
|
+
|
218
|
+
fileupload:
|
219
|
+
button: "Оберіть файл"
|
220
|
+
max_size: "Макс. р."
|
216
221
|
|
217
222
|
flash:
|
218
223
|
manage:
|
@@ -59,12 +59,6 @@ module Sunrise
|
|
59
59
|
get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
|
60
60
|
end
|
61
61
|
|
62
|
-
# Add devise routes
|
63
|
-
def add_routes
|
64
|
-
route "devise_for :users"
|
65
|
-
route "resources :pages, :only => [:show]"
|
66
|
-
end
|
67
|
-
|
68
62
|
# copy migration files
|
69
63
|
def create_migrations
|
70
64
|
if options.migrations
|
@@ -74,6 +68,32 @@ module Sunrise
|
|
74
68
|
end
|
75
69
|
end
|
76
70
|
|
71
|
+
def dependent_generators
|
72
|
+
say_status("invoke dependent generators", "", :green)
|
73
|
+
|
74
|
+
generate("simple_form:install")
|
75
|
+
generate("sunrise:file_upload:install")
|
76
|
+
generate("devise:install")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Add devise routes
|
80
|
+
def add_routes
|
81
|
+
route "devise_for :users"
|
82
|
+
route "resources :pages, :only => [:show]"
|
83
|
+
route 'root :to => "welcome#index"'
|
84
|
+
end
|
85
|
+
|
86
|
+
def autoload_paths
|
87
|
+
log :autoload_paths, "models/defaults and app/sweepers"
|
88
|
+
sentinel = /\.autoload_paths\s+\+=\s+\%W\(\#\{config\.root\}\/extras\)\s*$/
|
89
|
+
|
90
|
+
code = 'config.autoload_paths += %W(#{config.root}/app/models/defaults #{config.root}/app/sweepers)'
|
91
|
+
|
92
|
+
in_root do
|
93
|
+
inject_into_file 'config/application.rb', " #{code}\n", { :after => sentinel, :verbose => false }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
77
97
|
def self.next_migration_number(dirname)
|
78
98
|
if ActiveRecord::Base.timestamped_migrations
|
79
99
|
current_time.utc.strftime("%Y%m%d%H%M%S")
|
@@ -1,16 +1,2 @@
|
|
1
1
|
module Manage::AssetsHelper
|
2
|
-
|
3
|
-
def manage_assets_path_with_session_information(klass = 'Asset', options = {})
|
4
|
-
options = { :format => :xml, :protocol => "http://" }.merge(options)
|
5
|
-
session_key = Rails.application.config.send(:session_options)[:key]
|
6
|
-
|
7
|
-
options[session_key] = Rack::Utils.escape(cookies[session_key])
|
8
|
-
options[:klass] = klass
|
9
|
-
|
10
|
-
if protect_against_forgery?
|
11
|
-
options[request_forgery_protection_token] = Rack::Utils.escape(form_authenticity_token)
|
12
|
-
end
|
13
|
-
|
14
|
-
manage_assets_url(options)
|
15
|
-
end
|
16
2
|
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
// Collection of all instances on page
|
2
|
+
qq.FileUploader.instances = new Object();
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Class that creates upload widget with drag-and-drop and file list
|
6
|
+
* @inherits qq.FileUploaderBasic
|
7
|
+
*/
|
8
|
+
qq.FileUploaderInput = function(o){
|
9
|
+
// call parent constructor
|
10
|
+
qq.FileUploaderBasic.apply(this, arguments);
|
11
|
+
|
12
|
+
// additional options
|
13
|
+
qq.extend(this._options, {
|
14
|
+
element: null,
|
15
|
+
// if set, will be used instead of qq-upload-list in template
|
16
|
+
listElement: null,
|
17
|
+
|
18
|
+
template_id: '#fileupload_tmpl',
|
19
|
+
|
20
|
+
classes: {
|
21
|
+
// used to get elements from templates
|
22
|
+
button: 'fileupload-button',
|
23
|
+
drop: 'fileupload-drop-area',
|
24
|
+
dropActive: 'fileupload-drop-area-active',
|
25
|
+
list: 'fileupload-list',
|
26
|
+
preview: 'fileupload-preview',
|
27
|
+
|
28
|
+
file: 'fileupload-file',
|
29
|
+
spinner: 'fileupload-spinner',
|
30
|
+
size: 'fileupload-size',
|
31
|
+
cancel: 'fileupload-cancel',
|
32
|
+
|
33
|
+
// added to list item when upload completes
|
34
|
+
// used in css to hide progress spinner
|
35
|
+
success: 'fileupload-success',
|
36
|
+
fail: 'fileupload-fail'
|
37
|
+
}
|
38
|
+
});
|
39
|
+
// overwrite options with user supplied
|
40
|
+
qq.extend(this._options, o);
|
41
|
+
|
42
|
+
this._element = document.getElementById(this._options.element);
|
43
|
+
this._listElement = this._options.listElement || this._find(this._element, 'list');
|
44
|
+
|
45
|
+
this._classes = this._options.classes;
|
46
|
+
|
47
|
+
this._button = this._createUploadButton(this._find(this._element, 'button'));
|
48
|
+
|
49
|
+
//this._setupDragDrop();
|
50
|
+
|
51
|
+
qq.FileUploader.instances[this._element.id] = this;
|
52
|
+
};
|
53
|
+
|
54
|
+
// inherit from Basic Uploader
|
55
|
+
qq.extend(qq.FileUploaderInput.prototype, qq.FileUploaderBasic.prototype);
|
56
|
+
|
57
|
+
qq.extend(qq.FileUploaderInput.prototype, {
|
58
|
+
/**
|
59
|
+
* Gets one of the elements listed in this._options.classes
|
60
|
+
**/
|
61
|
+
_find: function(parent, type){
|
62
|
+
var element = qq.getByClass(parent, this._options.classes[type])[0];
|
63
|
+
if (!element){
|
64
|
+
throw new Error('element not found ' + type);
|
65
|
+
}
|
66
|
+
|
67
|
+
return element;
|
68
|
+
},
|
69
|
+
_setupDragDrop: function(){
|
70
|
+
var self = this,
|
71
|
+
dropArea = this._find(this._element, 'drop');
|
72
|
+
|
73
|
+
var dz = new qq.UploadDropZone({
|
74
|
+
element: dropArea,
|
75
|
+
onEnter: function(e){
|
76
|
+
qq.addClass(dropArea, self._classes.dropActive);
|
77
|
+
e.stopPropagation();
|
78
|
+
},
|
79
|
+
onLeave: function(e){
|
80
|
+
e.stopPropagation();
|
81
|
+
},
|
82
|
+
onLeaveNotDescendants: function(e){
|
83
|
+
qq.removeClass(dropArea, self._classes.dropActive);
|
84
|
+
},
|
85
|
+
onDrop: function(e){
|
86
|
+
dropArea.style.display = 'none';
|
87
|
+
qq.removeClass(dropArea, self._classes.dropActive);
|
88
|
+
self._uploadFileList(e.dataTransfer.files);
|
89
|
+
}
|
90
|
+
});
|
91
|
+
|
92
|
+
dropArea.style.display = 'none';
|
93
|
+
|
94
|
+
qq.attach(document, 'dragenter', function(e){
|
95
|
+
if (!dz._isValidFileDrag(e)) return;
|
96
|
+
|
97
|
+
dropArea.style.display = 'block';
|
98
|
+
});
|
99
|
+
qq.attach(document, 'dragleave', function(e){
|
100
|
+
if (!dz._isValidFileDrag(e)) return;
|
101
|
+
|
102
|
+
var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
|
103
|
+
// only fire when leaving document out
|
104
|
+
if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
|
105
|
+
dropArea.style.display = 'none';
|
106
|
+
}
|
107
|
+
});
|
108
|
+
},
|
109
|
+
_onSubmit: function(id, fileName){
|
110
|
+
qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
|
111
|
+
this._addToList(id, fileName);
|
112
|
+
},
|
113
|
+
_onProgress: function(id, fileName, loaded, total){
|
114
|
+
qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);
|
115
|
+
|
116
|
+
/*var item = this._getItemByFileId(id);
|
117
|
+
var size = this._find(item, 'size');
|
118
|
+
size.style.display = 'inline';
|
119
|
+
|
120
|
+
var text;
|
121
|
+
if (loaded != total){
|
122
|
+
text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
|
123
|
+
} else {
|
124
|
+
text = this._formatSize(total);
|
125
|
+
}
|
126
|
+
|
127
|
+
qq.setText(size, text);*/
|
128
|
+
},
|
129
|
+
_onComplete: function(id, fileName, result){
|
130
|
+
qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
|
131
|
+
|
132
|
+
var item = this._getItemByFileId(id);
|
133
|
+
var asset = result.asset;
|
134
|
+
|
135
|
+
// mark completed
|
136
|
+
//qq.remove(this._find(item, 'cancel'));
|
137
|
+
//qq.remove(this._find(item, 'spinner'));
|
138
|
+
|
139
|
+
if (asset && asset.id){
|
140
|
+
qq.addClass(item, this._classes.success);
|
141
|
+
|
142
|
+
$(item).replaceWith( $(this._options.template_id).tmpl(asset) );
|
143
|
+
} else {
|
144
|
+
qq.addClass(item, this._classes.fail);
|
145
|
+
}
|
146
|
+
},
|
147
|
+
_addToList: function(id, fileName){
|
148
|
+
if (this._listElement) {
|
149
|
+
if (this._options.multiple === false) {
|
150
|
+
$(this._listElement).empty();
|
151
|
+
}
|
152
|
+
|
153
|
+
var asset = {id: 0, filename: this._formatFileName(fileName),
|
154
|
+
url: "#",
|
155
|
+
thumb_url: "/images/manage/preloader.gif"};
|
156
|
+
|
157
|
+
var item = $(this._options.template_id)
|
158
|
+
.tmpl(asset)
|
159
|
+
.attr('qqfileid', id)
|
160
|
+
.appendTo( this._listElement );
|
161
|
+
|
162
|
+
this._bindCancelEvent(item);
|
163
|
+
}
|
164
|
+
},
|
165
|
+
_getItemByFileId: function(id){
|
166
|
+
return $(this._listElement).find('div[qqfileid=' + id +']').get(0);
|
167
|
+
},
|
168
|
+
/**
|
169
|
+
* delegate click event for cancel link
|
170
|
+
**/
|
171
|
+
_bindCancelEvent: function(element){
|
172
|
+
var self = this,
|
173
|
+
item = $(element);
|
174
|
+
|
175
|
+
item.find('a.' + this._classes.cancel).bind('click', function(e){
|
176
|
+
self._handler.cancel( item.attr('qqfileid') );
|
177
|
+
item.remove();
|
178
|
+
qq.preventDefault(e);
|
179
|
+
return false;
|
180
|
+
});
|
181
|
+
}
|
182
|
+
});
|
@@ -85,8 +85,10 @@ var Manage = {
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
|
88
|
-
init_assets: function(
|
88
|
+
init_assets: function(element_id, url, sortable)
|
89
89
|
{
|
90
|
+
var query = '#' + element_id + ' div.galery';
|
91
|
+
|
90
92
|
$(query + " a.fancybox").fancybox({
|
91
93
|
'titleShow' : false,
|
92
94
|
'transitionIn' : 'none',
|
@@ -97,18 +99,20 @@ var Manage = {
|
|
97
99
|
$(this).parents('div.asset').remove();
|
98
100
|
});
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
if (sortable) {
|
103
|
+
$(query).sortable({
|
104
|
+
revert: true,
|
105
|
+
update: function(event, ui){
|
106
|
+
var data = $(query).sortable('serialize');
|
107
|
+
$.ajax({
|
108
|
+
url: url,
|
109
|
+
data: data,
|
110
|
+
dataType: 'script',
|
111
|
+
type: 'POST'
|
112
|
+
});
|
113
|
+
}
|
114
|
+
});
|
115
|
+
}
|
112
116
|
}
|
113
117
|
};
|
114
118
|
|
@@ -43,9 +43,5 @@ class User < ActiveRecord::Base
|
|
43
43
|
# Setup accessible (or protected) attributes for your model
|
44
44
|
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
def to_param
|
49
|
-
"#{id}-#{login}"
|
50
|
-
end
|
46
|
+
fileuploads :avatar
|
51
47
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* cupid green (inspired by okcupid.com)
|
2
|
+
*******************************************************************************/
|
3
|
+
button.cupid-green {
|
4
|
+
background: #7fbf4d;
|
5
|
+
background: -moz-linear-gradient(top, #7fbf4d 0%, #63a62f 100%);
|
6
|
+
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7fbf4d), to(#63a62f));
|
7
|
+
border: 1px solid #63a62f;
|
8
|
+
border-bottom: 1px solid #5b992b;
|
9
|
+
-moz-border-radius: 3px;
|
10
|
+
-webkit-border-radius: 3px;
|
11
|
+
border-radius: 3px;
|
12
|
+
-moz-box-shadow: inset 0 1px 0 0 #96ca6d;
|
13
|
+
-webkit-box-shadow: inset 0 1px 0 0 #96ca6d;
|
14
|
+
box-shadow: inset 0 1px 0 0 #96ca6d;
|
15
|
+
color: #fff;
|
16
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
17
|
+
font-size: 11px;
|
18
|
+
font-weight: bold;
|
19
|
+
line-height: 1;
|
20
|
+
padding: 7px 0 8px 0;
|
21
|
+
text-align: center;
|
22
|
+
text-shadow: 0 -1px 0 #4c9021;
|
23
|
+
width: 120px;
|
24
|
+
}
|
25
|
+
|
26
|
+
button.cupid-green:hover {
|
27
|
+
background: #76b347;
|
28
|
+
background: -moz-linear-gradient(top, #76b347 0%, #5e9e2e 100%);
|
29
|
+
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#76b347), to(#5e9e2e));
|
30
|
+
-moz-box-shadow: inset 0 1px 0 0 #8dbf67;
|
31
|
+
-webkit-box-shadow: inset 0 1px 0 0 #8dbf67;
|
32
|
+
box-shadow: inset 0 1px 0 0 #8dbf67;
|
33
|
+
cursor: pointer;
|
34
|
+
}
|
35
|
+
|
36
|
+
button.cupid-green:active {
|
37
|
+
border: 1px solid #5b992b;
|
38
|
+
border-bottom: 1px solid #538c27;
|
39
|
+
-moz-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eee;
|
40
|
+
-webkit-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eee;
|
41
|
+
box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eee;
|
42
|
+
}
|
@@ -464,6 +464,17 @@ input.text {
|
|
464
464
|
display: block;
|
465
465
|
line-height: 37px;
|
466
466
|
}
|
467
|
+
.buts button.gr {
|
468
|
+
display: block;
|
469
|
+
float: left;
|
470
|
+
color: #fff;
|
471
|
+
text-decoration: none;
|
472
|
+
line-height: 37px;
|
473
|
+
font-size: 1.1em;
|
474
|
+
}
|
475
|
+
.controls {
|
476
|
+
padding: 20px 0px 10px 20px;
|
477
|
+
}
|
467
478
|
.sort {
|
468
479
|
display: block;
|
469
480
|
overflow: hidden;
|