It works, but I'm not happy with the bootstrap hackery. Must fix.
This commit is contained in:
parent
f4090dd0d2
commit
738ea5cc8d
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
|
@ -81,7 +81,7 @@ module.exports = (grunt) ->
|
||||||
appDir: "dist"
|
appDir: "dist"
|
||||||
baseUrl: "."
|
baseUrl: "."
|
||||||
paths:
|
paths:
|
||||||
jquery: "../libs/jquery/jquery-1.7.2"
|
jquery: "../assets/jquery/jquery-1.7.2"
|
||||||
pragmas:
|
pragmas:
|
||||||
doExclude: true
|
doExclude: true
|
||||||
modules: [ name: "priority" ]
|
modules: [ name: "priority" ]
|
||||||
|
@ -91,9 +91,10 @@ module.exports = (grunt) ->
|
||||||
|
|
||||||
install:
|
install:
|
||||||
src: [
|
src: [
|
||||||
"libs/jquery/jquery-1.7.2.js"
|
"assets/jquery/jquery-1.7.2.js"
|
||||||
"libs/require.js"
|
"assets/require.js"
|
||||||
"libs/lawnchair/lawnchair.js"
|
"assets/lawnchair/lawnchair.js"
|
||||||
|
"assets/images/*.png"
|
||||||
]
|
]
|
||||||
dest: "dist"
|
dest: "dist"
|
||||||
|
|
||||||
|
|
4
grunt.js
4
grunt.js
|
@ -96,7 +96,7 @@ module.exports = function(grunt) {
|
||||||
appDir: "dist",
|
appDir: "dist",
|
||||||
baseUrl: ".",
|
baseUrl: ".",
|
||||||
paths: {
|
paths: {
|
||||||
jquery: "../libs/jquery/jquery-1.7.2"
|
jquery: "../assets/jquery/jquery-1.7.2"
|
||||||
},
|
},
|
||||||
pragmas: {
|
pragmas: {
|
||||||
doExclude: true
|
doExclude: true
|
||||||
|
@ -111,7 +111,7 @@ module.exports = function(grunt) {
|
||||||
findNestedDependencies: true
|
findNestedDependencies: true
|
||||||
},
|
},
|
||||||
install: {
|
install: {
|
||||||
src: ["libs/jquery/jquery-1.7.2.js", "libs/require.js", "libs/lawnchair/lawnchair.js"],
|
src: ["assets/jquery/jquery-1.7.2.js", "assets/require.js", "assets/lawnchair/lawnchair.js", "assets/images/*.png"],
|
||||||
dest: "dist"
|
dest: "dist"
|
||||||
},
|
},
|
||||||
mocha: {
|
mocha: {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
.edit-priority
|
|
||||||
.input.edit-priority-field(type="text" value="<%= p.name %>" data-for="<%= p.pos %>")
|
|
||||||
.button.delete-priority-field(data-for="<%= p.pos %>")
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
.edit-priority
|
||||||
|
%input.edit-priority-field(type="text" value="<%= p.name %>" data-pos="<%= p.pos %>" data-ty="<%= type %>")
|
||||||
|
%button.delete-priority-field(data-for="<%= p.pos %>")
|
|
@ -16,10 +16,10 @@
|
||||||
.flow
|
.flow
|
||||||
.row-fluid
|
.row-fluid
|
||||||
#leftbrain.span6
|
#leftbrain.span6
|
||||||
%h1#prioritize(data-for="0") Today I Will Pay Attention To:
|
%h1#prioritize(data-pos="N" data-ty="priority") Today I Will Pay Attention To:
|
||||||
#priorities
|
#priorities
|
||||||
#rightbrain.span6
|
#rightbrain.span6
|
||||||
%h1#ignorize(data-for="0") Today I Will Ignore:
|
%h1#ignorize(data-pos="N" data-ty="ignore") Today I Will Ignore:
|
||||||
#ignorities
|
#ignorities
|
||||||
|
|
||||||
#message(style="display:none")
|
#message(style="display:none")
|
||||||
|
|
|
@ -2,7 +2,7 @@ require.config
|
||||||
paths:
|
paths:
|
||||||
'jquery': 'jquery-1.7.2'
|
'jquery': 'jquery-1.7.2'
|
||||||
|
|
||||||
require ['jquery', 'priority_tmpl', 'lawnchair'], ($, priority_template) ->
|
require ['jquery', 'priority_tmpl', 'edit_priority_tmpl', 'lawnchair'], ($, priority_template, edit_priority_template) ->
|
||||||
|
|
||||||
class Prioritize
|
class Prioritize
|
||||||
|
|
||||||
|
@ -12,45 +12,68 @@ require ['jquery', 'priority_tmpl', 'lawnchair'], ($, priority_template) ->
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
$('body').on 'click', @render
|
$('body').on 'click', @render
|
||||||
$('#prioritize').on 'click', (ev) => @editPriority(ev, 'priority')
|
$('#prioritize').on 'click', @editPriority
|
||||||
$('#ignorize').on 'click', (ev) => @editPriority(ev, 'ignore')
|
$('#ignorize').on 'click', @editPriority
|
||||||
|
|
||||||
|
|
||||||
editPriority: (ev, ty = 'parent') =>
|
editPriority: (ev) =>
|
||||||
|
|
||||||
|
|
||||||
newPriority: (ty, ev) =>
|
|
||||||
ev.stopPropagation()
|
ev.stopPropagation()
|
||||||
return if $('.edit-priority').length > 0
|
|
||||||
target = if ty == 'priority' then $('#priorities') else $('#ignorities')
|
|
||||||
target.append(edit_priorities_template({fur: ty}))
|
|
||||||
input = $('input.edit-priority-field', target)
|
|
||||||
|
|
||||||
maybeNewPrioritySave = (ev) =>
|
# Only allow one edit-priority at a time!
|
||||||
|
return if $('.edit-priority').length > 0
|
||||||
|
|
||||||
|
tg = $(ev.currentTarget)
|
||||||
|
ty = tg.data('ty')
|
||||||
|
pos = tg.data('pos')
|
||||||
|
|
||||||
|
# If the position is 'N', we're adding a new list item to
|
||||||
|
# the bottom of a list to be populated.
|
||||||
|
|
||||||
|
if pos == 'N'
|
||||||
|
@priorities.push({name: '', cat: ty})
|
||||||
|
pos = @priorities.length - 1
|
||||||
|
(if ty == 'priority' then $('#priorities') else $('#ignorities'))
|
||||||
|
.append('<li class="priority" id="pos-' + pos + '"></li>')
|
||||||
|
|
||||||
|
# Replace the list item's contents with the editor's
|
||||||
|
# content.
|
||||||
|
li = $('#pos-' + pos)
|
||||||
|
li.html edit_priority_template
|
||||||
|
p:
|
||||||
|
name: @priorities[pos].name
|
||||||
|
pos: pos
|
||||||
|
type: ty
|
||||||
|
|
||||||
|
input = $('input.edit-priority-field', li)
|
||||||
|
|
||||||
|
maybePrioritySave = (ev) =>
|
||||||
prioritySave = =>
|
prioritySave = =>
|
||||||
@priorities.push({cat: ty, name: input.val()})
|
@priorities[pos] = {cat: ty, name: input.val()}
|
||||||
@save()
|
@save()
|
||||||
|
|
||||||
code = if ev.keyCode then ev.keyCode else ev.which
|
code = if ev.keyCode then ev.keyCode else ev.which
|
||||||
return prioritySave() if code == 13
|
return prioritySave() if code == 13
|
||||||
return @cleanAndRender() if code == 27
|
return @cleanAndRender() if code == 27
|
||||||
|
|
||||||
input.on 'keyup', maybeNewPrioritySave
|
deletePriority = (ev) =>
|
||||||
$('.delete-priority-field', target).on 'click', @render
|
ev.stopPropagation()
|
||||||
|
@priorities[pos].name = ""
|
||||||
|
@save()
|
||||||
|
|
||||||
|
input.on 'keyup', maybePrioritySave
|
||||||
|
$('.delete-priority-field', li).on 'click', deletePriority
|
||||||
input.focus()
|
input.focus()
|
||||||
|
|
||||||
save: ->
|
save: ->
|
||||||
|
@clean()
|
||||||
@repo.save {key: 'priorities', 'priorities': @priorities}, () =>
|
@repo.save {key: 'priorities', 'priorities': @priorities}, () =>
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
clean: ->
|
clean: ->
|
||||||
@priorities = ({name: p.name, cat: p.cat} for p in @priorities when c.name.trim() != "")
|
@priorities = ({name: p.name, cat: p.cat} for p in @priorities when p.name.trim() != "")
|
||||||
|
|
||||||
cleanAndRender: ->
|
|
||||||
@clean()
|
|
||||||
@render()
|
|
||||||
|
|
||||||
save: ->
|
save: ->
|
||||||
|
@clean()
|
||||||
@repo.save {key: 'priorities', 'priorities': @priorities}, =>
|
@repo.save {key: 'priorities', 'priorities': @priorities}, =>
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
|
@ -62,8 +85,9 @@ require ['jquery', 'priority_tmpl', 'lawnchair'], ($, priority_template) ->
|
||||||
r.push({name: @priorities[i].name, cat: @priorities[i].cat, pos: i})
|
r.push({name: @priorities[i].name, cat: @priorities[i].cat, pos: i})
|
||||||
r
|
r
|
||||||
|
|
||||||
$('#priorities').html(priority_template({priorities: priority_enumerate('priority')}))
|
$('#priorities').html(priority_template({priorities: priority_enumerate('priority'), type: 'priority'}))
|
||||||
$('#ignorities').html(priority_template({priorities: priority_enumerate('ignore')}))
|
$('#ignorities').html(priority_template({priorities: priority_enumerate('ignore'), type: 'ignore'}))
|
||||||
|
$('.priorityc').bind 'click', @editPriority
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
prioritize = new Lawnchair {name: 'Prioritize'}, ->
|
prioritize = new Lawnchair {name: 'Prioritize'}, ->
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%ul.priorities
|
%ul.priorities
|
||||||
<% var i,l,p; for(i=0,l=priorities.length;i<l;++i) { p=priorities[i]; %>
|
<% var i,l,p; for(i=0,l=priorities.length;i<l;++i) { p=priorities[i]; %>
|
||||||
%li.task
|
%li.priority(id="pos-<%= p.pos %>")
|
||||||
.taskc <%= p.name %>
|
.priorityc(data-ty="<%= type %>" data-pos="<%= p.pos %>") <%= p.name %>
|
||||||
<% } %>
|
<% } %>
|
|
@ -96,6 +96,76 @@ body {
|
||||||
@fluidGridColumnWidth: 6.382978723%;
|
@fluidGridColumnWidth: 6.382978723%;
|
||||||
@fluidGridGutterWidth: 2.127659574%;
|
@fluidGridGutterWidth: 2.127659574%;
|
||||||
|
|
||||||
|
@baseFontSize: 13px;
|
||||||
|
@baseLineHeight: 18px;
|
||||||
|
|
||||||
|
@inputBackground: #fff;
|
||||||
|
@inputBorder: #ccc;
|
||||||
|
@inputBorderRadius: 3px;
|
||||||
|
@inputDisabledBackground: #eee;
|
||||||
|
|
||||||
|
.transition(@transition) {
|
||||||
|
-webkit-transition: @transition;
|
||||||
|
-moz-transition: @transition;
|
||||||
|
-ms-transition: @transition;
|
||||||
|
-o-transition: @transition;
|
||||||
|
transition: @transition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Border Radius
|
||||||
|
.border-radius(@radius) {
|
||||||
|
-webkit-border-radius: @radius;
|
||||||
|
-moz-border-radius: @radius;
|
||||||
|
border-radius: @radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop shadows
|
||||||
|
.box-shadow(@shadow) {
|
||||||
|
-webkit-box-shadow: @shadow;
|
||||||
|
-moz-box-shadow: @shadow;
|
||||||
|
box-shadow: @shadow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inputs, Textareas, Selects
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
select,
|
||||||
|
.uneditable-input {
|
||||||
|
display: inline-block;
|
||||||
|
width: 210px;
|
||||||
|
height: @baseLineHeight;
|
||||||
|
padding: 4px;
|
||||||
|
margin-bottom: 9px;
|
||||||
|
font-size: @baseFontSize;
|
||||||
|
line-height: @baseLineHeight;
|
||||||
|
color: #555;
|
||||||
|
background-color: @inputBackground;
|
||||||
|
border: 1px solid @inputBorder;
|
||||||
|
.border-radius(@inputBorderRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help out input buttons
|
||||||
|
input[type="button"],
|
||||||
|
input[type="reset"],
|
||||||
|
input[type="submit"] {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
textarea {
|
||||||
|
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
|
||||||
|
@transition: border linear .2s, box-shadow linear .2s;
|
||||||
|
.transition(@transition);
|
||||||
|
}
|
||||||
|
input:focus,
|
||||||
|
textarea:focus {
|
||||||
|
border-color: rgba(82,168,236,.8);
|
||||||
|
outline: 0;
|
||||||
|
outline: thin dotted \9; /* IE6-9 */
|
||||||
|
.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
|
||||||
|
}
|
||||||
|
|
||||||
#grid {
|
#grid {
|
||||||
|
|
||||||
.core (@gridColumnWidth, @gridGutterWidth) {
|
.core (@gridColumnWidth, @gridGutterWidth) {
|
||||||
|
|
Loading…
Reference in New Issue