Adds desc form; fixes some styling.
authordsc <dsc@wikimedia.org>
Thu, 8 Mar 2012 18:43:31 +0000 (10:43 -0800)
committerdsc <dsc@wikimedia.org>
Thu, 8 Mar 2012 18:46:26 +0000 (10:46 -0800)
lib/server/server.co
lib/template/graph.jade
lib/vis/vis-view.co
www/css/graph.styl
www/css/text.styl
www/graph/edit.jade

index 4bf161b..5d29b1f 100755 (executable)
@@ -148,7 +148,7 @@ app.get '/preset/:slug', (req, res, next) ->
         # req.url += '.json'
     next()
 
-app.get '/graph/:slug/?', (req, res, next) ->
+app.get '/graph(/:slug)?/?', (req, res, next) ->
     {slug} = req.params
     # console.log '/graph/:slug/?'
     # console.log '  slug:  ', slug
index 9a3dd6b..74e403e 100644 (file)
@@ -29,20 +29,24 @@ section.graph(id=graph_id)
                     .graph-info-pane.tab-pane.active(id="graph-#{graph_id}-info")
                         .row-fluid
                             .half.control-group
-                                label.slug.control-label(for='slug') Slug
-                                .controls
-                                    input.span3.slug(type='text', id='slug', name='slug', placeholder='graph_slug', value=slug)
-                                    p.help-block The slug uniquely identifies this graph and will be displayed in the URL.
-                            .half.control-group
-                        .row-fluid
+                                .control-group
+                                    label.slug.control-label(for='slug') Slug
+                                    .controls
+                                        input.span3.slug(type='text', id='slug', name='slug', placeholder='graph_slug', value=slug)
+                                        p.help-block The slug uniquely identifies this graph and will be displayed in the URL.
+                                .control-group
+                                    label.width.control-label(for='width') Size
+                                    .controls
+                                        input.span1.width(type='text', id='width', name='width', value=width)
+                                        |  &times; 
+                                        input.span1.height(type='text', id='height', name='height', value=height)
+                                        p.help-block Choosing 'auto' will size the graph to the viewport bounds.
                             .half.control-group
-                                label.width.control-label(for='width') Width
+                                label.desc.control-label(for='desc') Description
                                 .controls
-                                    input.span1.width(type='text', id='width', name='width', value=width)
-                                    p.help-block Choosing 'auto' will size the graph to the viewport bounds.
-                            .half.control-group
-                                label.height.control-label(for='height') Height
-                                .controls: input.span1.height(type='text', id='height', name='height', value=height)
+                                    //- textarea.span3.desc(id='desc', name='desc', placeholder='Graph description.') #{desc}
+                                    <textarea class="span3 desc" id="desc" name="desc" placeholder="Graph description.">#{desc}</textarea>
+                                    p.help-block A description of the graph.
                     
                     .graph-data-pane.tab-pane(id="graph-#{graph_id}-data")
                         .row-fluid
index c72e94e..1927620 100644 (file)
@@ -61,7 +61,7 @@ VisView = exports.VisView = BaseView.extend do # {{{
         # Note: can't debounce the method itself, as the debounce wrapper returns undefined
         $ root .on 'resize', _.debounce(@resizeViewport, DEBOUNCE_RENDER)
         
-        @id = _.domize 'graph', (@model.id or @model.cid)
+        @id = _.domize 'graph', (@model.get('slug', @model.id or @model.cid))
         
         @model.on 'destroy', @remove, this
         @model.on 'change',  @render, this
@@ -109,18 +109,18 @@ VisView = exports.VisView = BaseView.extend do # {{{
             [k, v, opts] = arguments
             values = { "#k": v }
         
-        options = @scaffold.collection
+        fields = @scaffold.collection
         if values
             for k, v in values
-                options.get(k)?.setValue v, opts
+                fields.get(k)?.setValue v, opts
             this
         else
-            opts = @model.toJSON({ -keepDefaults })?.options or {}
+            options = @model.toJSON({ -keepDefaults })?.options or {}
             for k of @FILTER_CHART_OPTIONS
-                # console.log "filter #k?", not opts[k]
-                if k in opts and not opts[k]
-                    delete opts[k]
-            opts
+                # console.log "filter #k?", not options[k]
+                if k in options and not options[k]
+                    delete options[k]
+            options
     
     /**
      * Resizes chart according to the model's width and height.
index ebf30a3..fd8812c 100644 (file)
@@ -3,6 +3,8 @@
 
 section.graph
     position relative
+    max-width 900px
+    margin 0 auto
     
     *
         position relative
@@ -174,9 +176,9 @@ section.graph
             z-index 2
             width auto
             min-width 50px
-            min-height 1.5em
+            min-height 2em
             max-width none
-            line-height 1.5
+            line-height 2
             
             cursor pointer
             text-align center
index 32134cc..3bcf9d7 100644 (file)
@@ -7,7 +7,7 @@ $fonts_headers = "gotham rounded", "helvetica neue", helvetica, arial, sans-seri
 
 html, body
     font-family $fonts_body
-    font-size $font_size
+    // font-size $font_size
     line-height 1.5
     color $body_text
     background-color $foot_bgcolor
index 5033daa..73b1bf2 100644 (file)
@@ -4,7 +4,6 @@ block title
     title Kraken: Graph Test Page
 
 append styles
-    mixin css('forms.css')
     mixin css('graph.css')
     mixin css('isotope.css')