Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more theming stuff

  • Loading branch information...
commit 3f5cbeea6ae90cf8ed62df1ad1b62915d2eb3142 1 parent 097bcc3
@mikecrittenden authored
View
4 app/assets/javascripts/app/models/favor.js
@@ -1,7 +1,7 @@
App.Favor = Ember.Resource.extend({
resourceName: 'favor',
resourceUrl: '/favors',
- resourceProperties: ['id', 'title', 'description', 'created_at', 'updated_at', 'points', 'user_id', 'status', 'helper_id', 'accepted_at', 'resolution', 'earned'],
+ resourceProperties: ['id', 'title', 'description', 'created_at', 'updated_at', 'points', 'user_id', 'status', 'helper_id', 'accepted_at', 'resolution', 'earned', 'is_accepted'],
// The URL of the individual favor.
url: function() {
@@ -90,8 +90,6 @@ App.Favor = Ember.Resource.extend({
approveWork: function() {
this.set('status', 'closed');
- this.set('is_accepted', 'true');
-
this.saveResource().fail(function(e) {
alert("Oops, something went wrong. Reload the page and try again, and if that doesn't work, contact us.");
});
View
2  app/assets/javascripts/app/templates/favors/moderate.handlebars
@@ -1,5 +1,5 @@
{{#view Ember.Button tagName="a" class="btn btn-success" target="parentView" href="#" action="approveWork"}}Approve and award points{{/view}}
-<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+<a class="btn btn-success dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
View
12 app/assets/javascripts/app/templates/favors/show.handlebars
@@ -15,7 +15,9 @@
</div>
{{#if isOwner}}
- {{view App.AdminControlsView favorBinding="this"}}
+ {{#unless isClosed}}
+ {{view App.AdminControlsView favorBinding="this"}}
+ {{/unless}}
{{/if}}
</div>
@@ -45,7 +47,13 @@
</div>
<div class="span4">
- {{view App.FavorWorkView favorBinding="this"}}
+ {{#if App.user_id}}
+ {{view App.FavorWorkView favorBinding="this"}}
+ {{else}}
+ <h2>Log in or sign up to help</h2>
+ <hr />
+ <p>If you want to help out with this task, you have to <a href="/users/sign_in">log in</a> or <a href="/users/sign_up">sign up</a> first. It only takes a few seconds!</p>
+ {{/if}}
</div>
</div>
View
1  app/assets/javascripts/application.js
@@ -18,6 +18,7 @@
//= require ./vendor/bootstrap-tab
//= require ./vendor/bootstrap-modal
//= require ./vendor/bootstrap-dropdown
+//= require ./vendor/bootstrap-collapse
//= require ./vendor/date-utils
//= require ./vendor/textext
//= require_tree ./lib
View
136 app/assets/javascripts/vendor/bootstrap-collapse.js
@@ -0,0 +1,136 @@
+/* =============================================================
+ * bootstrap-collapse.js v2.0.1
+ * http://twitter.github.com/bootstrap/javascript.html#collapse
+ * =============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+!function( $ ){
+
+ "use strict"
+
+ var Collapse = function ( element, options ) {
+ this.$element = $(element)
+ this.options = $.extend({}, $.fn.collapse.defaults, options)
+
+ if (this.options["parent"]) {
+ this.$parent = $(this.options["parent"])
+ }
+
+ this.options.toggle && this.toggle()
+ }
+
+ Collapse.prototype = {
+
+ constructor: Collapse
+
+ , dimension: function () {
+ var hasWidth = this.$element.hasClass('width')
+ return hasWidth ? 'width' : 'height'
+ }
+
+ , show: function () {
+ var dimension = this.dimension()
+ , scroll = $.camelCase(['scroll', dimension].join('-'))
+ , actives = this.$parent && this.$parent.find('.in')
+ , hasData
+
+ if (actives && actives.length) {
+ hasData = actives.data('collapse')
+ actives.collapse('hide')
+ hasData || actives.data('collapse', null)
+ }
+
+ this.$element[dimension](0)
+ this.transition('addClass', 'show', 'shown')
+ this.$element[dimension](this.$element[0][scroll])
+
+ }
+
+ , hide: function () {
+ var dimension = this.dimension()
+ this.reset(this.$element[dimension]())
+ this.transition('removeClass', 'hide', 'hidden')
+ this.$element[dimension](0)
+ }
+
+ , reset: function ( size ) {
+ var dimension = this.dimension()
+
+ this.$element
+ .removeClass('collapse')
+ [dimension](size || 'auto')
+ [0].offsetWidth
+
+ this.$element.addClass('collapse')
+ }
+
+ , transition: function ( method, startEvent, completeEvent ) {
+ var that = this
+ , complete = function () {
+ if (startEvent == 'show') that.reset()
+ that.$element.trigger(completeEvent)
+ }
+
+ this.$element
+ .trigger(startEvent)
+ [method]('in')
+
+ $.support.transition && this.$element.hasClass('collapse') ?
+ this.$element.one($.support.transition.end, complete) :
+ complete()
+ }
+
+ , toggle: function () {
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
+ }
+
+ }
+
+ /* COLLAPSIBLE PLUGIN DEFINITION
+ * ============================== */
+
+ $.fn.collapse = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('collapse')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.collapse.defaults = {
+ toggle: true
+ }
+
+ $.fn.collapse.Constructor = Collapse
+
+
+ /* COLLAPSIBLE DATA-API
+ * ==================== */
+
+ $(function () {
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
+ var $this = $(this), href
+ , target = $this.attr('data-target')
+ || e.preventDefault()
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
+ $(target).collapse(option)
+ })
+ })
+
+}( window.jQuery );
View
27 app/assets/stylesheets/favors.css
@@ -229,7 +229,22 @@ blockquote p {
.modal {
display: none;
+ background: #22252A;
}
+ .modal .modal-header {
+ border-bottom: 1px solid #444;
+ background-color: #30343A;
+ box-shadow: none;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ }
+ .modal .modal-footer {
+ background-color: #30343A;
+ border-top: 1px solid #444;
+ box-shadow: none;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ }
.modal textarea {
width: 98%;
@@ -258,6 +273,9 @@ blockquote p {
border-color: #47bcb2;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}
+.btn-primary .caret, .btn-success .caret {
+ border-top-color: black;
+}
.btn-primary:hover,
.btn-primary:active,
.btn-primary.active,
@@ -289,8 +307,8 @@ blockquote p {
.btn-danger.active,
.btn-danger.disabled,
.btn-danger[disabled] {
- background-color: #e85151}
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+ background-color: #e85151;
+}
.btn-danger:active, .btn-danger.active {
background-color: #942a25 \9;
}
@@ -317,6 +335,7 @@ blockquote p {
.btn-success[disabled] {
background-color: #b3db57;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+ color: black;
}
.btn-success:active, .btn-success.active {
background-color: #408140 \9;
@@ -336,10 +355,6 @@ blockquote p {
text-align: right;
}
-#new_favor .input-xlarge {
- width: 400px;
-}
-
#error_explanation {
color: #B94A48;
background-color: #F2DEDE;
View
2  app/controllers/favors_controller.rb
@@ -79,7 +79,7 @@ def update
@favor = Favor.find(params[:id])
respond_to do |format|
if @favor.update_attributes(params[:favor])
- if defined? params[:favor]['is_accepted'] and params[:favor]['is_accepted']
+ if @favor.status == 'closed'
# If the owner just accepted this favor, credit the helper with the points.
@user = User.find(@favor.helper_id)
@user.points = @user.points + @favor.earned
View
6 app/views/favors/_form.html.erb
@@ -18,6 +18,7 @@
<%= f.label :title %>
<div class="controls">
<%= f.text_field :title, :class => 'input-xlarge' %>
+ <p class="help-block">Enter a descriptive but short title for this request.</p>
</div>
</div>
@@ -25,6 +26,7 @@
<%= f.label :description %>
<div class="controls">
<%= f.text_area :description, :class => 'input-xlarge', :rows => 10 %>
+ <p class="help-block">Be sure to include any information that a helper might possibly need, or else your task won't be completed.</p>
</div>
</div>
@@ -32,6 +34,7 @@
<%= f.label :points %>
<div class="controls">
<%= f.text_field :points, :class => 'input-xlarge' %>
+ <p class="help-block">These points will immediately be deducted from your account, and whoever finishes your favor first gets them.</p>
</div>
</div>
@@ -39,11 +42,12 @@
<%= f.label :tag_list %>
<div class="controls">
<%= f.text_field :tag_list, :class => 'input-xlarge' %>
+ <p class="help-block">Enter a list of up to 5 tags, separated by commas.</p>
</div>
</div>
<div class="form-actions">
- <button type="submit" class="btn btn-primary">Save favor</button>
+ <button type="submit" class="btn btn-success">Save favor</button>
<a href="/" class="btn">Cancel</a>
</div>
</fieldset>
Please sign in to comment.
Something went wrong with that request. Please try again.