Skip to content

Commit

Permalink
calendar widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Purcell committed Aug 26, 2010
1 parent b710d75 commit b688c4f
Show file tree
Hide file tree
Showing 9 changed files with 553 additions and 31 deletions.
110 changes: 108 additions & 2 deletions app/stylesheets/screen.sass
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import "standard"
@import "mixins"

@import "compass/css3/box-shadow"
@import "compass/css3"

.task
width: 100%
Expand All @@ -26,6 +26,14 @@ ul.tags

ul#tasks
margin-top: 15px
li.ui-selected:not(.completed)
+box(#E2EBFA, #E2EBFA)
li.ui-selected.completed
+box(#B7C2C6, #B7C2C6)
li.ui-selecting:not(.completed)
+box(#E2EBFA, #E2EBFA)
li.ui-selecting.completed
+box(#B7C2C6, #B7C2C6)

ul#tag_list
display: inline
Expand Down Expand Up @@ -68,4 +76,102 @@ form.new_task
.task .completed_on
font-size: 50%
margin-right: 1em



#cal
background: #e0e0e0
+box-shadow(0px, 3px, 3px, rgba(0,0,0,0.25))
margin: 50px auto
font: 13px/1.5 "Helvetica Neue", Helvatica, Arial, san-serif
display: table
.header
cursor: default
background: #cd310d
+linear-gradient(color-stops(#b32b0c,#cd310d))
height: 34px
position: relative
color: #fff
+border-top-left-radius(5px)
+border-top-right-radius(5px)
font-weight: bold
text-shadow: 0px -1px 0 #87260c
text-transform: uppercase
span
display: inline-block
line-height: 34px
.hook
width: 9px
height: 28px
position: absolute
bottom: 60%
+border-radius(10px)
background: #ececec
+linear-gradient(color-stops(#fff,#827e7d))
+box-shadow(rgba(0,0,0,0.65), 0px, -1px, 2px)
&.right
right: 15%
&.left
left: 15%
.button
width: 24px
text-align: center
position: absolute
&.left
left: 0
+border-top-left-radius(5px)
border-right: 1px solid #ae2a0c
&.right
right: 0
top: 0
+border-top-right-radius(5px)
border-left: 1px solid #ae2a0c
&:hover
+linear-gradient(color-stops(#d94215, #bb330f))
.month-year
letter-spacing: 1px
width: 100%
text-align: center
table
background: #fff
border-collapse: collapse
td
color: #2b2b2b
width: 30px
height: 30px
line-height: 30px
text-align: center
border: 1px solid #e6e6e6
cursor: default
#days
td
height: 26px
line-height: 26px
text-transform: uppercase
font-size: 90%
color: #9e9e9e
&:not(:last-child)
border-right: 1px solid #fff
#cal-frame
td.today
background: #ededed
color: #8c8c8c
+box-shadow(#fff, 1px, 1px, 0px, 0, inset)
td:not(.nil):hover
color: #fff
text-shadow: #6c1a07 0px, -1px
background: #cd310d
+linear-gradient(color-stops(#b32b0c,#cd310d))
+box-shadow(#fff, 0px, 0px, 0px)
td span
font-size: 80%
position: relative
&:first-child
bottom: 5px
&:last-child
top: 5px
table.curr
float: left
table.temp
position: absolute


Binary file added app/views/calendars/._calendar.html.haml.swm
Binary file not shown.
Binary file added app/views/calendars/._calendar.html.haml.swn
Binary file not shown.
60 changes: 60 additions & 0 deletions app/views/calendars/_calendar.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#cal
.header
%span#prev{:class => "left button"} ⟨
%span{:class => "left hook"}
%span#label.month-year June 2010
%span{:class => "right hook"}
%span#next{:class => "right button"} ⟩
%table#days
%td sun
%td mon
%td tue
%td wed
%td thu
%td fri
%td sat
#cal-frame
%table.curr
%tbody
%tr
%td.nil
%td.nil
%td 1
%td 2
%td 3
%td 4
%td 5
%tr
%td 6
%td 7
%td 8
%td 9
%td 10
%td.today 11
%td 12
%tr
%td 13
%td 14
%td 15
%td 16
%td 17
%td 18
%td 19
%tr
%td 20
%td 21
%td 22
%td 23
%td 24
%td 25
%td 26
%tr
%td 27
%td 28
%td 29
%td 30
%td.nil
%td.nil
%td.nil


24 changes: 15 additions & 9 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
%head
%title Todo
= stylesheet_link_tag 'screen'
= javascript_include_tag "prototype.s2.min.js"
= javascript_include_tag :defaults
= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"
= csrf_meta_tag
%body.content
#notification
-if flash[:notice]
.notice= flash[:notice]
-if flash[:alert]
.alert= flash[:alert]
-if flash[:error]
.error= flash[:error]
= yield
%body.container
.content
%section.content-main
#notification
-if flash[:notice]
.notice= flash[:notice]
-if flash[:alert]
.alert= flash[:alert]
-if flash[:error]
.error= flash[:error]
#loading Loading ...
= yield

%section.content-sub
= render :partial => "calendars/calendar"
= yield :javascript
18 changes: 15 additions & 3 deletions app/views/lists/_sort.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= javascript_tag do %>
$('#tasks').sortable(
$j('#tasks').sortable(
{
axis: 'y',
dropOnEmpty:false,
Expand All @@ -9,14 +9,26 @@
opacity: 0.4,
scroll: true,
update: function(){
$.ajax({
$j.ajax({
type: 'post',
data: $('#tasks').sortable('serialize') + '&id=<%=@list.id-%>',
data: $j('#tasks').sortable('serialize') + '&id=<%=@list.id-%>',
dataType: 'script',
complete: function(request){
},
url: '/lists/prioritize_tasks'})
}
})
//$("#tasks").selectable(
//selected: function(event, ui) { $("li.task.ui-selected").focus(); },
//unselected: function(event, ui) {}
// );
$j("#tasks li").keyup( function(){
if (e.keyCode == '46' || e.keyCode == '8')
{
console.log("Delete pressed");
e.preventDefault();
}
});

<% end %>

2 changes: 1 addition & 1 deletion app/views/lists/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
%ul#tag_list
- @tags.each do |tag|
%li= link_to_unless_current tag.name, tagged_task_path(@list.id,tag.name)

%ul#tasks
= render @tasks


= form_for [@list, @task], :remote => true do |f|
%ul
%li
Expand Down
Loading

0 comments on commit b688c4f

Please sign in to comment.