avatars_for_rails 0.0.1
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/.gitignore +10 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +138 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +91 -0
- data/Rakefile +29 -0
- data/app/controllers/avatars_controller.rb +109 -0
- data/app/models/avatar.rb +138 -0
- data/app/views/avatars/_errors.html.erb +6 -0
- data/app/views/avatars/_form.html.erb +128 -0
- data/app/views/avatars/_includes.html.erb +14 -0
- data/app/views/avatars/_list.html.erb +39 -0
- data/app/views/avatars/_new.html.erb +15 -0
- data/app/views/avatars/_precrop.html.erb +38 -0
- data/app/views/avatars/destroy.js.erb +2 -0
- data/app/views/avatars/edit.html.erb +8 -0
- data/app/views/avatars/index.html.erb +4 -0
- data/app/views/avatars/new.html.erb +1 -0
- data/app/views/avatars/show.html.erb +8 -0
- data/app/views/avatars/update.js.erb +6 -0
- data/avatars_for_rails.gemspec +40 -0
- data/config/locales/en.yml +28 -0
- data/config/routes.rb +6 -0
- data/lib/avatars_for_rails/avatars_controller_config.rb +4 -0
- data/lib/avatars_for_rails.rb +27 -0
- data/lib/generators/avatars_for_rails/install_generator.rb +28 -0
- data/lib/generators/avatars_for_rails/templates/initializer.rb +11 -0
- data/lib/generators/avatars_for_rails/templates/migration.rb +20 -0
- data/lib/generators/avatars_for_rails/templates/public/images/Jcrop.gif +0 -0
- data/lib/generators/avatars_for_rails/templates/public/images/cancel.png +0 -0
- data/lib/generators/avatars_for_rails/templates/public/images/pbar-ani.gif +0 -0
- data/lib/generators/avatars_for_rails/templates/public/images/rails.png +0 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/application.js +2 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/avatars.js +8 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/controls.js +965 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/dragdrop.js +974 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/effects.js +1123 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery-ui.min.js +401 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.Jcrop.min.js +163 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.fileupload-ui.js +259 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.fileupload.js +475 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.form.js +815 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/jquery.js +7179 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/prototype.js +6001 -0
- data/lib/generators/avatars_for_rails/templates/public/javascripts/rails.js +158 -0
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/.gitkeep +0 -0
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/avatars.css +115 -0
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/jquery.Jcrop.css +35 -0
- data/lib/generators/avatars_for_rails/templates/public/stylesheets/jquery.fileupload-ui.css +70 -0
- data/spec/avatars_for_rails_spec.rb +7 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/actor.rb +7 -0
- data/spec/dummy/app/views/layouts/application.html.erb +20 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/avatars_for_rails.rb +6 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20110411073237_create_actors.rb +13 -0
- data/spec/dummy/db/migrate/20110411073238_create_avatars.rb +21 -0
- data/spec/dummy/db/schema.rb +32 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/images/Jcrop.gif +0 -0
- data/spec/dummy/public/images/cancel.png +0 -0
- data/spec/dummy/public/images/pbar-ani.gif +0 -0
- data/spec/dummy/public/images/rails.png +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/avatars.js +8 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/jquery-ui.min.js +401 -0
- data/spec/dummy/public/javascripts/jquery.Jcrop.min.js +163 -0
- data/spec/dummy/public/javascripts/jquery.fileupload-ui.js +259 -0
- data/spec/dummy/public/javascripts/jquery.fileupload.js +475 -0
- data/spec/dummy/public/javascripts/jquery.form.js +815 -0
- data/spec/dummy/public/javascripts/jquery.js +7179 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +158 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/public/stylesheets/avatars.css +115 -0
- data/spec/dummy/public/stylesheets/jquery.Jcrop.css +35 -0
- data/spec/dummy/public/stylesheets/jquery.fileupload-ui.css +70 -0
- data/spec/dummy/public/system/logos/1/actor/stream20110411-3539-1e9l1hn-0.jpg +0 -0
- data/spec/dummy/public/system/logos/1/original/stream20110411-3539-1e9l1hn-0.jpg +0 -0
- data/spec/dummy/public/system/logos/1/profile/stream20110411-3539-1e9l1hn-0.jpg +0 -0
- data/spec/dummy/public/system/logos/1/representation/stream20110411-3539-1e9l1hn-0.jpg +0 -0
- data/spec/dummy/public/system/logos/1/tie/stream20110411-3539-1e9l1hn-0.jpg +0 -0
- data/spec/dummy/public/system/logos/2/actor/stream20110411-3539-1hlzauh-0.jpeg +0 -0
- data/spec/dummy/public/system/logos/2/original/stream20110411-3539-1hlzauh-0.jpeg +0 -0
- data/spec/dummy/public/system/logos/2/profile/stream20110411-3539-1hlzauh-0.jpeg +0 -0
- data/spec/dummy/public/system/logos/2/representation/stream20110411-3539-1hlzauh-0.jpeg +0 -0
- data/spec/dummy/public/system/logos/2/tie/stream20110411-3539-1hlzauh-0.jpeg +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/spec_helper.rb +33 -0
- metadata +333 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unobtrusive scripting adapter for jQuery
|
|
3
|
+
*
|
|
4
|
+
* Requires jQuery 1.4.3 or later.
|
|
5
|
+
* https://github.com/rails/jquery-ujs
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
(function($) {
|
|
9
|
+
// Make sure that every Ajax request sends the CSRF token
|
|
10
|
+
function CSRFProtection(xhr) {
|
|
11
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
|
12
|
+
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
|
13
|
+
}
|
|
14
|
+
if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) });
|
|
15
|
+
else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) });
|
|
16
|
+
|
|
17
|
+
// Triggers an event on an element and returns the event result
|
|
18
|
+
function fire(obj, name, data) {
|
|
19
|
+
var event = $.Event(name);
|
|
20
|
+
obj.trigger(event, data);
|
|
21
|
+
return event.result !== false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Submits "remote" forms and links with ajax
|
|
25
|
+
function handleRemote(element) {
|
|
26
|
+
var method, url, data,
|
|
27
|
+
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
|
28
|
+
|
|
29
|
+
if (fire(element, 'ajax:before')) {
|
|
30
|
+
if (element.is('form')) {
|
|
31
|
+
method = element.attr('method');
|
|
32
|
+
url = element.attr('action');
|
|
33
|
+
data = element.serializeArray();
|
|
34
|
+
// memoized value from clicked submit button
|
|
35
|
+
var button = element.data('ujs:submit-button');
|
|
36
|
+
if (button) {
|
|
37
|
+
data.push(button);
|
|
38
|
+
element.data('ujs:submit-button', null);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
method = element.data('method');
|
|
42
|
+
url = element.attr('href');
|
|
43
|
+
data = null;
|
|
44
|
+
}
|
|
45
|
+
$.ajax({
|
|
46
|
+
url: url, type: method || 'GET', data: data, dataType: dataType,
|
|
47
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
|
48
|
+
beforeSend: function(xhr, settings) {
|
|
49
|
+
if (settings.dataType === undefined) {
|
|
50
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
|
51
|
+
}
|
|
52
|
+
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
|
53
|
+
},
|
|
54
|
+
success: function(data, status, xhr) {
|
|
55
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
|
56
|
+
},
|
|
57
|
+
complete: function(xhr, status) {
|
|
58
|
+
element.trigger('ajax:complete', [xhr, status]);
|
|
59
|
+
},
|
|
60
|
+
error: function(xhr, status, error) {
|
|
61
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Handles "data-method" on links such as:
|
|
68
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
|
69
|
+
function handleMethod(link) {
|
|
70
|
+
var href = link.attr('href'),
|
|
71
|
+
method = link.data('method'),
|
|
72
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
|
73
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
|
74
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
|
75
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
|
76
|
+
|
|
77
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
|
78
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
form.hide().append(metadata_input).appendTo('body');
|
|
82
|
+
form.submit();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function disableFormElements(form) {
|
|
86
|
+
form.find('input[data-disable-with]').each(function() {
|
|
87
|
+
var input = $(this);
|
|
88
|
+
input.data('ujs:enable-with', input.val())
|
|
89
|
+
.val(input.data('disable-with'))
|
|
90
|
+
.attr('disabled', 'disabled');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function enableFormElements(form) {
|
|
95
|
+
form.find('input[data-disable-with]').each(function() {
|
|
96
|
+
var input = $(this);
|
|
97
|
+
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function allowAction(element) {
|
|
102
|
+
var message = element.data('confirm');
|
|
103
|
+
return !message || (fire(element, 'confirm') && confirm(message));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function requiredValuesMissing(form) {
|
|
107
|
+
var missing = false;
|
|
108
|
+
form.find('input[name][required]').each(function() {
|
|
109
|
+
if (!$(this).val()) missing = true;
|
|
110
|
+
});
|
|
111
|
+
return missing;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
|
115
|
+
var link = $(this);
|
|
116
|
+
if (!allowAction(link)) return false;
|
|
117
|
+
|
|
118
|
+
if (link.data('remote') != undefined) {
|
|
119
|
+
handleRemote(link);
|
|
120
|
+
return false;
|
|
121
|
+
} else if (link.data('method')) {
|
|
122
|
+
handleMethod(link);
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
$('form').live('submit.rails', function(e) {
|
|
128
|
+
var form = $(this), remote = form.data('remote') != undefined;
|
|
129
|
+
if (!allowAction(form)) return false;
|
|
130
|
+
|
|
131
|
+
// skip other logic when required values are missing
|
|
132
|
+
if (requiredValuesMissing(form)) return !remote;
|
|
133
|
+
|
|
134
|
+
if (remote) {
|
|
135
|
+
handleRemote(form);
|
|
136
|
+
return false;
|
|
137
|
+
} else {
|
|
138
|
+
// slight timeout so that the submit button gets properly serialized
|
|
139
|
+
setTimeout(function(){ disableFormElements(form) }, 13);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
|
144
|
+
var button = $(this);
|
|
145
|
+
if (!allowAction(button)) return false;
|
|
146
|
+
// register the pressed submit button
|
|
147
|
+
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
|
148
|
+
button.closest('form').data('ujs:submit-button', data);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
$('form').live('ajax:beforeSend.rails', function(event) {
|
|
152
|
+
if (this == event.target) disableFormElements($(this));
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
$('form').live('ajax:complete.rails', function(event) {
|
|
156
|
+
if (this == event.target) enableFormElements($(this));
|
|
157
|
+
});
|
|
158
|
+
})( jQuery );
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/******************** Common ***********************/
|
|
2
|
+
*{
|
|
3
|
+
font-family: Arial;
|
|
4
|
+
font-size: 11px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.clearfloat { clear: both; height: 0px;}
|
|
8
|
+
.space_center { padding-top: 9px; padding-right: 4px; text-align: center;}
|
|
9
|
+
h2{padding-left:10px;font-size: 14px;color: #2A3890;}
|
|
10
|
+
/******************** Avatars ***********************/
|
|
11
|
+
.avatars {
|
|
12
|
+
padding-left: 10px;
|
|
13
|
+
}
|
|
14
|
+
.avatar {
|
|
15
|
+
float:left;
|
|
16
|
+
position:relative;
|
|
17
|
+
}
|
|
18
|
+
.avatar .actions {
|
|
19
|
+
}
|
|
20
|
+
.avatar .delete_avatar {
|
|
21
|
+
position:absolute;
|
|
22
|
+
top:5px;
|
|
23
|
+
right:5px;
|
|
24
|
+
display:none;
|
|
25
|
+
}
|
|
26
|
+
.avatar .default {
|
|
27
|
+
border: 5px solid #2A3890;
|
|
28
|
+
}
|
|
29
|
+
.avatar .non_default {
|
|
30
|
+
border: 5px solid #E0EEF5;
|
|
31
|
+
}
|
|
32
|
+
/******************** New form ***********************/
|
|
33
|
+
.new_logo_form {
|
|
34
|
+
}
|
|
35
|
+
/******************** Slide Effect ***********************/
|
|
36
|
+
.boxgrid {
|
|
37
|
+
width: 104px;
|
|
38
|
+
height: 104px;
|
|
39
|
+
float:left;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
position: relative;
|
|
42
|
+
}
|
|
43
|
+
.boxgrid img {
|
|
44
|
+
position: absolute;
|
|
45
|
+
top: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
border: 0;
|
|
48
|
+
}
|
|
49
|
+
.boxcaption {
|
|
50
|
+
top: 104px;
|
|
51
|
+
left: 5px;
|
|
52
|
+
float: left;
|
|
53
|
+
position: absolute;
|
|
54
|
+
background: #E0EEF5;
|
|
55
|
+
opacity: .8;
|
|
56
|
+
width: 84px;
|
|
57
|
+
height: 28px;
|
|
58
|
+
/* For IE 5-7 */
|
|
59
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
|
60
|
+
/* For IE 8 */
|
|
61
|
+
-MS-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
|
62
|
+
}
|
|
63
|
+
.captionfull .boxcaption {
|
|
64
|
+
top: 104px;
|
|
65
|
+
left: 5px;
|
|
66
|
+
padding: 5px;
|
|
67
|
+
}
|
|
68
|
+
/**************** Crop **************/
|
|
69
|
+
#precropDiv {
|
|
70
|
+
width:499px;
|
|
71
|
+
display:inline-block;
|
|
72
|
+
padding: 0px 30px 0px 29px;
|
|
73
|
+
}
|
|
74
|
+
#precropPrev {
|
|
75
|
+
vertical-align:top;
|
|
76
|
+
display:inline-block;
|
|
77
|
+
/*padding: 5px 4px 5px 4px;*/
|
|
78
|
+
}
|
|
79
|
+
#precropPrevImg {
|
|
80
|
+
width:100px;
|
|
81
|
+
height:100px;
|
|
82
|
+
overflow:hidden;
|
|
83
|
+
margin-left:30px;
|
|
84
|
+
border: 1px solid #E0EEF5;
|
|
85
|
+
}
|
|
86
|
+
/************** BLOCK DIV SECTION *********/
|
|
87
|
+
.block .content{ padding: 5px 4px 5px 4px;}
|
|
88
|
+
.block .form_row { display: block; padding:5px; padding-left:20px; }
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/*************REVIEW ********************/
|
|
92
|
+
* { margin: 0; padding: 0; font-family: Arial; }
|
|
93
|
+
html, body {height: 100%;}
|
|
94
|
+
.p { margin: 0px; padding: 0px; font-size: inherit; font-family: inherit; font-weight: inherit;
|
|
95
|
+
text-align: inherit; color: inherit; line-height: inherit; vertical-align: top;}
|
|
96
|
+
p { padding-top: 0px; margin-top: 0px;}
|
|
97
|
+
img { border: 0px;}
|
|
98
|
+
div { margin: 0px; padding: 0px; font-family: Helvetica; font-size: 11px;}
|
|
99
|
+
.AbsWrap { width: 100%; position: relative;}
|
|
100
|
+
.rowWrap { width: 100%;}
|
|
101
|
+
a:link,a:visited { color: inherit; text-decoration: inherit;}
|
|
102
|
+
a:hover { text-decoration: underline;}
|
|
103
|
+
.clearfloat { clear: both; height: 0px;}
|
|
104
|
+
h2{padding-left:10px;}
|
|
105
|
+
body{font-size:1.0em; color:#2A3890; background-color:#ffffff; }
|
|
106
|
+
#wrapper { background-color: #f5f5f5; width: 100%; margin: 0px auto; }
|
|
107
|
+
#wrapper_body{min-height: 552px; width: 960px; margin:0px auto; margin-left: auto; margin-right: auto;
|
|
108
|
+
margin-top: auto; margin-bottom:auto;}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
.button{margin: 10px 0 10px 10px;padding: 3px 3px 3px 3px;color:#FFFFFF;background-color: #1F4A75;}
|
|
114
|
+
|
|
115
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
|
|
2
|
+
.jcrop-holder { text-align: left; }
|
|
3
|
+
|
|
4
|
+
.jcrop-vline, .jcrop-hline
|
|
5
|
+
{
|
|
6
|
+
font-size: 0;
|
|
7
|
+
position: absolute;
|
|
8
|
+
background: white url('Jcrop.gif') top left repeat;
|
|
9
|
+
}
|
|
10
|
+
.jcrop-vline { height: 100%; width: 1px !important; }
|
|
11
|
+
.jcrop-hline { width: 100%; height: 1px !important; }
|
|
12
|
+
.jcrop-handle {
|
|
13
|
+
font-size: 1px;
|
|
14
|
+
width: 7px !important;
|
|
15
|
+
height: 7px !important;
|
|
16
|
+
border: 1px #eee solid;
|
|
17
|
+
background-color: #333;
|
|
18
|
+
*width: 9px;
|
|
19
|
+
*height: 9px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.jcrop-tracker { width: 100%; height: 100%; }
|
|
23
|
+
|
|
24
|
+
.custom .jcrop-vline,
|
|
25
|
+
.custom .jcrop-hline
|
|
26
|
+
{
|
|
27
|
+
background: yellow;
|
|
28
|
+
}
|
|
29
|
+
.custom .jcrop-handle
|
|
30
|
+
{
|
|
31
|
+
border-color: black;
|
|
32
|
+
background-color: #C7BB00;
|
|
33
|
+
-moz-border-radius: 3px;
|
|
34
|
+
-webkit-border-radius: 3px;
|
|
35
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.file_upload {
|
|
2
|
+
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
direction: ltr;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
text-align: center;
|
|
7
|
+
color: #333;
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
-moz-border-radius: 10px;
|
|
10
|
+
-webkit-border-radius: 10px;
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
width: 200px;
|
|
13
|
+
height: 30px;
|
|
14
|
+
line-height: 30px;
|
|
15
|
+
background: palegreen;
|
|
16
|
+
border: 1px solid limegreen;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.file_upload_small {
|
|
20
|
+
width: 200px;
|
|
21
|
+
height: 30px;
|
|
22
|
+
line-height: 30px;
|
|
23
|
+
font-size: auto;
|
|
24
|
+
background: palegreen;
|
|
25
|
+
border: 1px solid limegreen;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.file_upload_large {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 150px;
|
|
31
|
+
line-height: 150px;
|
|
32
|
+
font-size: 20px;
|
|
33
|
+
background: palegreen;
|
|
34
|
+
border: 1px solid limegreen;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.file_upload_highlight {
|
|
38
|
+
background: lawngreen;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.file_upload input {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0;
|
|
44
|
+
right: 0;
|
|
45
|
+
margin: 0;
|
|
46
|
+
border: 300px solid transparent;
|
|
47
|
+
opacity: 0;
|
|
48
|
+
-ms-filter: 'alpha(opacity=0)';
|
|
49
|
+
filter: alpha(opacity=0);
|
|
50
|
+
-o-transform: translate(-300px, -300px) scale(10);
|
|
51
|
+
-moz-transform: translate(-800px, 0) scale(10);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.file_upload iframe, .file_upload button {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.file_upload_progress .ui-progressbar-value {
|
|
60
|
+
background: url(../images/pbar-ani.gif);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.file_upload_progress div {
|
|
64
|
+
width: 150px;
|
|
65
|
+
height: 15px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.file_upload_cancel div {
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
|
5
|
+
require 'rake'
|
|
6
|
+
|
|
7
|
+
Dummy::Application.load_tasks
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<% stylesheet_link_tag :all %>
|
|
6
|
+
<% javascript_include_tag :defaults %>
|
|
7
|
+
<%= yield :headers %>
|
|
8
|
+
<%= csrf_meta_tag %>
|
|
9
|
+
<script type="text/javascript" charset="utf-8">
|
|
10
|
+
$(document).ready(function() {
|
|
11
|
+
<%= yield :javascript %>
|
|
12
|
+
})
|
|
13
|
+
</script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
<%= yield %>
|
|
18
|
+
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require "active_model/railtie"
|
|
4
|
+
require "active_record/railtie"
|
|
5
|
+
require "action_controller/railtie"
|
|
6
|
+
require "action_view/railtie"
|
|
7
|
+
require "action_mailer/railtie"
|
|
8
|
+
|
|
9
|
+
Bundler.require
|
|
10
|
+
require "avatars_for_rails"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
module Dummy
|
|
14
|
+
class Application < Rails::Application
|
|
15
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
16
|
+
# Application configuration should go into files in config/initializers
|
|
17
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
18
|
+
|
|
19
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
20
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
21
|
+
|
|
22
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
23
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
24
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
25
|
+
|
|
26
|
+
# Activate observers that should always be running.
|
|
27
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
28
|
+
|
|
29
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
30
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
31
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
32
|
+
|
|
33
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
34
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
35
|
+
# config.i18n.default_locale = :de
|
|
36
|
+
|
|
37
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
|
38
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
|
39
|
+
|
|
40
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
41
|
+
config.encoding = "utf-8"
|
|
42
|
+
|
|
43
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
44
|
+
config.filter_parameters += [:password]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
development:
|
|
4
|
+
adapter: sqlite3
|
|
5
|
+
database: db/development.sqlite3
|
|
6
|
+
pool: 5
|
|
7
|
+
timeout: 5000
|
|
8
|
+
|
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
|
10
|
+
# re-generated from your development database when you run "rake".
|
|
11
|
+
# Do not set this db to the same as development or production.
|
|
12
|
+
test:
|
|
13
|
+
adapter: sqlite3
|
|
14
|
+
database: db/test.sqlite3
|
|
15
|
+
pool: 5
|
|
16
|
+
timeout: 5000
|
|
17
|
+
|
|
18
|
+
production:
|
|
19
|
+
adapter: sqlite3
|
|
20
|
+
database: db/production.sqlite3
|
|
21
|
+
pool: 5
|
|
22
|
+
timeout: 5000
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Dummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_view.debug_rjs = true
|
|
15
|
+
config.action_controller.perform_caching = false
|
|
16
|
+
|
|
17
|
+
# Don't care if the mailer can't send
|
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
|
19
|
+
|
|
20
|
+
# Print deprecation notices to the Rails logger
|
|
21
|
+
config.active_support.deprecation = :log
|
|
22
|
+
|
|
23
|
+
# Only use best-standards-support built into browsers
|
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Dummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
|
5
|
+
# Code is not reloaded between requests
|
|
6
|
+
config.cache_classes = true
|
|
7
|
+
|
|
8
|
+
# Full error reports are disabled and caching is turned on
|
|
9
|
+
config.consider_all_requests_local = false
|
|
10
|
+
config.action_controller.perform_caching = true
|
|
11
|
+
|
|
12
|
+
# Specifies the header that your server uses for sending files
|
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
|
14
|
+
|
|
15
|
+
# For nginx:
|
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
|
17
|
+
|
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
|
19
|
+
# just comment this out and Rails will serve the files
|
|
20
|
+
|
|
21
|
+
# See everything in the log (default is :info)
|
|
22
|
+
# config.log_level = :debug
|
|
23
|
+
|
|
24
|
+
# Use a different logger for distributed setups
|
|
25
|
+
# config.logger = SyslogLogger.new
|
|
26
|
+
|
|
27
|
+
# Use a different cache store in production
|
|
28
|
+
# config.cache_store = :mem_cache_store
|
|
29
|
+
|
|
30
|
+
# Disable Rails's static asset server
|
|
31
|
+
# In production, Apache or nginx will already do this
|
|
32
|
+
config.serve_static_assets = false
|
|
33
|
+
|
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
|
+
|
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
39
|
+
|
|
40
|
+
# Enable threaded mode
|
|
41
|
+
# config.threadsafe!
|
|
42
|
+
|
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
|
45
|
+
config.i18n.fallbacks = true
|
|
46
|
+
|
|
47
|
+
# Send deprecation notices to registered listeners
|
|
48
|
+
config.active_support.deprecation = :notify
|
|
49
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Dummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# The test environment is used exclusively to run your application's
|
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
+
config.cache_classes = true
|
|
9
|
+
|
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
|
11
|
+
config.whiny_nils = true
|
|
12
|
+
|
|
13
|
+
# Show full error reports and disable caching
|
|
14
|
+
config.consider_all_requests_local = true
|
|
15
|
+
config.action_controller.perform_caching = false
|
|
16
|
+
|
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
|
18
|
+
config.action_dispatch.show_exceptions = false
|
|
19
|
+
|
|
20
|
+
# Disable request forgery protection in test environment
|
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
|
22
|
+
|
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
|
25
|
+
# ActionMailer::Base.deliveries array.
|
|
26
|
+
config.action_mailer.delivery_method = :test
|
|
27
|
+
|
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
30
|
+
# like if you have constraints or database-specific column types
|
|
31
|
+
# config.active_record.schema_format = :sql
|
|
32
|
+
|
|
33
|
+
# Print deprecation notices to the stderr
|
|
34
|
+
config.active_support.deprecation = :stderr
|
|
35
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
|
5
|
+
|
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Add new inflection rules using the following format
|
|
4
|
+
# (all these examples are active by default):
|
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
8
|
+
# inflect.irregular 'person', 'people'
|
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
|
10
|
+
# end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
7
|
+
Dummy::Application.config.secret_token = 'd1ff11d93a78bddde73eace739008a7d6bf84757f7953ca8ffb125335b1efb7602cc6d3f729e5bc582e5306a7d1904994567304b764abf5ee0ec15b603437b0a'
|