From bdc1d426b806f5d64ef68b71cc480d727c71aca2 Mon Sep 17 00:00:00 2001 From: tristen Date: Wed, 5 Jun 2013 13:26:21 -0400 Subject: [PATCH] Save link now prompts a sidebar --- app.css | 80 ++++++-------- ...rose-129b77953cd92a716f7e5224f4de015e.eot} | Bin 6124 -> 6120 bytes ...rose-129b77953cd92a716f7e5224f4de015e.woff | Bin 0 -> 3784 bytes ...rose-80081ddd6bb627b0784ec9094fabb857.woff | Bin 3784 -> 0 bytes src/prose/models.js | 2 +- src/prose/views/app.js | 104 +++++++++++------- src/prose/views/post.js | 10 +- templates/app.html | 2 +- templates/settings.html | 14 +-- templates/sidebarSave.html | 12 ++ 10 files changed, 113 insertions(+), 111 deletions(-) rename fonts/{prose-80081ddd6bb627b0784ec9094fabb857.eot => prose-129b77953cd92a716f7e5224f4de015e.eot} (73%) create mode 100644 fonts/prose-129b77953cd92a716f7e5224f4de015e.woff delete mode 100644 fonts/prose-80081ddd6bb627b0784ec9094fabb857.woff create mode 100644 templates/sidebarSave.html diff --git a/app.css b/app.css index 4b0853c1b..9a0d428d8 100644 --- a/app.css +++ b/app.css @@ -80,9 +80,9 @@ table { border-collapse: collapse; border-spacing:0; } @font-face { font-family:'Prose'; - src:url('fonts/prose-80081ddd6bb627b0784ec9094fabb857.eot'); - src:url('fonts/prose-80081ddd6bb627b0784ec9094fabb857.eot?#iefix') format('embedded-opentype'), - url('fonts/prose-80081ddd6bb627b0784ec9094fabb857.woff') format('woff'); + src:url('fonts/prose-129b77953cd92a716f7e5224f4de015e.eot'); + src:url('fonts/prose-129b77953cd92a716f7e5224f4de015e.eot?#iefix') format('embedded-opentype'), + url('fonts/prose-129b77953cd92a716f7e5224f4de015e.woff') format('woff'); font-weight:700; font-style:normal; } @@ -285,22 +285,22 @@ textarea#code { border-width:1px; } -::-webkit-input-placeholder { color:#d4d7d9; } -::-moz-placeholder { color:#d4d7d9; } -:-ms-input-placeholder { color:#d4d7d9; } -input:-moz-placeholder { color:#d4d7d9; } +::-webkit-input-placeholder { color:#a8afb2; } +::-moz-placeholder { color:#a8afb2; } +:-ms-input-placeholder { color:#a8afb2; } +input:-moz-placeholder { color:#a8afb2; } -.filepath::-webkit-input-placeholder { font-style:italic; } -.filepath::-moz-placeholder { font-style:italic; } -.filepath:-ms-input-placeholder { font-style:italic; } -.filepath:-moz-placeholder { font-style:italic; } +.filepath::-webkit-input-placeholder { color:#d4d7d9; font-style:italic; } +.filepath::-moz-placeholder { color:#d4d7d9; font-style:italic; } +.filepath:-ms-input-placeholder { color:#d4d7d9; font-style:italic; } +.filepath:-moz-placeholder { color:#d4d7d9; font-style:italic; } strong { font-weight:700; } em { font-style:italic; } /* For Diff Viewing */ del { - color:#d4d7d9; + color:#516066; padding:1px 0; } ins { @@ -483,7 +483,7 @@ ins { width:60px; height:30px; bottom:0; - right:0; + right:-30px; } .heading .filepath:focus, .heading .filepath:hover { @@ -557,6 +557,7 @@ ins { left:0; width:100%; padding:15px; + color:#3d494e; } .loading .loading-icon { background:transparent url('img/loader@33x33.gif') no-repeat; @@ -585,9 +586,10 @@ ins { z-index:5000; width:60px; height:100%; + border-left:1px solid #fff; } .open .vert { - border-left:1px solid #d4d7d9; + border-color:#d4d7d9; } .vert ul { @@ -690,18 +692,12 @@ ins { .published .ico.checkmark, .ico.checkmark, .ico.added { color:#90bb74; } - -.vert .ico.logout { color:#db6f6f; } - .ico.modified { color:#2099aa; } .ico.removed { color:#d35252; } - .ico.error { color:#db6f6f; } .ico.renamed { color:#bb9f1a; } .ico.private { color:#deb400; } -.vert .ico.logout:hover { background-color:#db6f6f; color:#fff; } - .ico { font-family:'Prose'; font-size:22px; @@ -735,12 +731,12 @@ ins { .ico.picture:before { content: "\f116"; } .ico.private:before { content: "\f117"; } .ico.question:before { content: "\f118"; } -.ico.quick-save:before { content: "\f119"; } -.ico.quote:before { content: "\f11a"; } -.ico.removed:before { content: "\f11b"; } -.ico.renamed:before { content: "\f11c"; } -.ico.repos:before { content: "\f11d"; } -.ico.rubbish:before { content: "\f11e"; } +.ico.quote:before { content: "\f119"; } +.ico.removed:before { content: "\f11a"; } +.ico.renamed:before { content: "\f11b"; } +.ico.repos:before { content: "\f11c"; } +.ico.rubbish:before { content: "\f11d"; } +.ico.save:before { content: "\f11e"; } .ico.saving:before { content: "\f11f"; } .ico.search:before { content: "\f120"; } .ico.sprocket:before { content: "\f121"; } @@ -1706,31 +1702,17 @@ ins { .sidebar .commit { position:relative; bottom:-4px; - display:none; } - .sidebar .commit .cancel { - position:absolute; - z-index:10; - top:30px; - right:5px; - display:block; - } - .cancel:hover { - color:#DB6F6F; - } - .sidebar .commit textarea { - padding-right:25px; - margin:8px 0 -2px; - display:block; - position:relative; - z-index:1; - height:90px; - resize:none; - -webkit-border-radius:4px 4px 0 0; - border-radius:4px 4px 0 0; - } - .sidebar .commit.active { + .sidebar .commit textarea { + padding-right:25px; + margin:8px 0 -2px; display:block; + position:relative; + z-index:1; + height:115px; + resize:none; + -webkit-border-radius:4px 4px 0 0; + border-radius:4px 4px 0 0; } /* ------------------------------------------ diff --git a/fonts/prose-80081ddd6bb627b0784ec9094fabb857.eot b/fonts/prose-129b77953cd92a716f7e5224f4de015e.eot similarity index 73% rename from fonts/prose-80081ddd6bb627b0784ec9094fabb857.eot rename to fonts/prose-129b77953cd92a716f7e5224f4de015e.eot index e07e4fd35cf00344054de5e71f85d617d017eb2c..19ef37eea9e9f9e6ba4832938962e96c82b0f7c4 100644 GIT binary patch delta 288 zcmaE(|3aVjg*XF)%S2XlmQ}(Q5fdFs*`NOBVPFu~n7GHDQDNdAN#;xQt0qe@>N58@ zwoUe6lyMOIq0-I3ARNQMz+_X9UtDt2Zi6NRgXjzf2F5l9Mg}0ozz|^}yegjG<|_j? z^9!H|!`Ul(axi-H5=ITi$rqSJm{{00KVq87$a#kK8=D4O09)DS29{Lr&4B__7$-mF z&)NJ`(2q%7fl&->Dgy%x11qC5l+DT@z?cnXvjN3BCP#_rsyi@TVPIxpWZ?v=hjI1UMx(sHMcZsSno9LQNek2;V*->l(BR7&u0c?UmkpKVy delta 307 zcmaE%|3;tnjW`2?$3#|h7EkpZ_a-`&vfrM$hJis`XW|}vMwN+wB$-cGNllhu)MZ}g zxM8vfql`oFrl(#E48k!C3{3U~`NbtS?KWsKFo@1!U|?)xU}OMN3=H>nsC&lq+k9o< zW_|$_VK{s4cOH!1yo6DMQH+I+fuGq9h!;We6$XB$d7B?GO=aYK#Ky#?!xqQZwz+{N zm3wlfV9w^J{8Jb=KNa+2QdeY@0NcXAz{0@F=mur8G6*o{LD_6T@$Sh{BD(5M3|APK z85mhOfoi!Jt)OgH1_eeRD4Pu^UcY&r2rDDIF@qt4E`#ah9il2M#)i74lkbbhZMG3x J$jFW4cmRw)NLK&= diff --git a/fonts/prose-129b77953cd92a716f7e5224f4de015e.woff b/fonts/prose-129b77953cd92a716f7e5224f4de015e.woff new file mode 100644 index 0000000000000000000000000000000000000000..1c378de228d4e86b81404e8d5780bdd13c7ef041 GIT binary patch literal 3784 zcmZu!XIK+mx19tC3JHQjs7hCQQ6M1FI|7DYrN)35ih%S0k&Z}F6a*0|(gXxSdWTR1 zLiHtrQl$4HT_9h4zx&+#=bm}inOSSEJ+tS`{5ae1o~9-M0?31|2Y~%OGpqld|G%NB zX`)Z|m5^g>WN`SPbLgMD~GW$lTyBG~!jF+#LML z&jm%0IVTxhfCo_T?%?(S0H8f&U7qZ}13%(>=IP<>L#~gK?8zeQQQsBI1^p+S>{0gi zz^@Cmv!*+zGIp%BZ|ndK7J}{Y%ka@tl4u%9LKs}f0oCI&1i0SOkQWE|pB%GOk2ZRI z`v5@MAIieQio~%2S^#+cf8$7}Wt6=$0J_eFMgg&M63aMBfQc6*^l!d{82Yrm^=oVE z7``eRhs&l`y`^X`fkJ`fZk9{lYQ+Ihd+C!F)7w2~cssQC(UBxL)UZDedLyhoUR#%u zg$0yq4lVv~E&UEi6adz=gFqHFpr<`)MNsW$DntlD0KlI$Iosp6p>@qmm#IiPybGMFB01P%rlgQqBHC~7HIDX&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r>DW;3r?m|;@GaTZ1={zjSZWR%lo~%sY!Y&L-iKHxhn%hjaI?Cn3De1~#4nB45OrMR)V4WrTzbGBVu{_@7gSJbP?iK`_XYY|wR)S`)T zawnNYDlw9~Fx&}OVcTY=Y&b0a-7EW0RM7V<0NUA+CMGfIXr_3ST|1ek#$0Dz3%9^< z<&)j`D@&!J+3Q)`brrqnuTi|GIRky~J5_nT2l6TBCW1z>>1umF2MT&Y5BYABquEWl z13Fc>ZU%HHDJOoKfA?#v(auetNE|XQpDEgpdN4n4J#`wxyq B)2RRe diff --git a/src/prose/models.js b/src/prose/models.js index 7234ca0cf..6888f7dbe 100644 --- a/src/prose/models.js +++ b/src/prose/models.js @@ -845,7 +845,7 @@ module.exports = { q.await((function() { cb(err, _.extend(post, { 'default_metadata': defaultMetadata, - 'markdown': _.markdown(file), + 'markdown': _.markdown(file.split('?')[0]), 'repo': repo, 'path': path, 'file': file.split('?')[0], diff --git a/src/prose/views/app.js b/src/prose/views/app.js index aa0e8db5b..2db6beb57 100644 --- a/src/prose/views/app.js +++ b/src/prose/views/app.js @@ -14,9 +14,7 @@ module.exports = Backbone.View.extend({ 'click .logout': 'logout', 'click a.item.removed': 'restoreFile', 'click a.save': 'save', - 'click a.save.confirm': 'updateFile', - 'click a.quick-save': 'updateFile', - 'click a.cancel': 'cancelSave', + 'click a.confirm': 'updateFile', 'click a.delete': 'deleteFile', 'click a.translate': 'translate', 'click .mobile-menu .toggle': 'toggleMobileClass', @@ -75,6 +73,7 @@ module.exports = Backbone.View.extend({ var errorPage = false; var hideInterface = false; // Flag for unauthenticated landing this.noMenu = false; // Prevents a mobile toggle from appearing when nto required. + this.viewing = app.state.mode; if (options) { if (options.hideInterface) hideInterface = options.hideInterface; @@ -98,10 +97,8 @@ module.exports = Backbone.View.extend({ // When the sidebar should be open. // Fix this in re-factor, could be much tighter - if (app.state.mode === 'tree') { - $('#prose').toggleClass('open', true); - $('#prose').toggleClass('mobile', false); - } else if (app.state.mode === '' && window.authenticated && app.state.user !== '') { + if (app.state.mode === 'tree' || + app.state.mode === '' && window.authenticated && app.state.user) { $('#prose').toggleClass('open', true); $('#prose').toggleClass('mobile', false); } else { @@ -122,8 +119,12 @@ module.exports = Backbone.View.extend({ }, headerContext: function(data, alterable) { - var view = this; var heading = _(window.app.templates.heading).template(); + + if (data.writable) this.writable = true; + if (data.lang) this.lang = data.lang; + if (data.metadata) this.metadata = data.metadata; + $('#heading').empty().append(heading(_.extend(data, { alterable: alterable ? true : false }))); @@ -134,23 +135,20 @@ module.exports = Backbone.View.extend({ }, sidebarContext: function(data) { - var sidebarTmpl; - if (app.state.mode === 'tree') { - sidebarTmpl = _(app.templates.sidebarProject).template(); - } else if (data.file) { - this.writable = data.writable; - sidebarTmpl = _(app.templates.settings).template(); + var tmpl = _(app.templates.sidebarProject).template(); + + // Branch Switching + _.defer(function() { + $('.chzn-select', this.el).chosen().change(function() { + router.navigate($(this).val(), true); + }); + }); + + $('#drawer', this.el) + .empty() + .append(tmpl(data)); } - - $('#drawer', this.el) - .empty() - .append(sidebarTmpl(data)); - - // Branch Switching - $('.chzn-select', this.el).chosen().change(function() { - router.navigate($(this).val(), true); - }); }, recentFiles: function(data) { @@ -185,16 +183,27 @@ module.exports = Backbone.View.extend({ }, settings: function(e) { - $navItems = $('.navigation a', this.el); - if (!this.viewing) this.viewing = app.state.mode; + var tmpl = _(app.templates.settings).template(); + var $navItems = $('.navigation a', this.el); if ($(e.target, this.el).hasClass('active')) { $navItems.removeClass('active'); $('.navigation .' + this.viewing, this.el).addClass('active'); $('#prose').toggleClass('open mobile', false); + + this.cancelSave(); } else { $navItems.removeClass('active'); $(e.target, this.el).addClass('active'); + + $('#drawer', this.el) + .empty() + .append(tmpl({ + lang: this.lang, + writable: this.writable, + metadata: this.metadata + })); + $('#prose').toggleClass('open mobile', true); } @@ -258,31 +267,46 @@ module.exports = Backbone.View.extend({ }, save: function(e) { + var tmpl = _(app.templates.sidebarSave).template(); this.eventRegister.trigger('save', e); + $navItems = $('.navigation a', this.el); - var $message = $('.commit-message', this.el); - var filepath = $('input.filepath').val(); - var filename = _.extractFilename(filepath)[1]; - var placeholder = 'Updated ' + filename; - if (app.state.mode === 'new') placeholder = 'Created ' + filename; + if ($(e.target, this.el).hasClass('active')) { + $navItems.removeClass('active'); + $('.navigation .' + this.viewing, this.el).addClass('active'); + $('#prose').toggleClass('open mobile', false); + this.cancelSave(); + } else { + $navItems.removeClass('active'); + $(e.target, this.el).addClass('active'); + + $('#drawer', this.el) + .empty() + .append(tmpl({ + writable: this.writable + })); - $('.commit', this.el).toggleClass('active', true); - $('.button.save', this.el).toggleClass('confirm', true); + $('#prose').toggleClass('open mobile', true); + + var $message = $('.commit-message', this.el); + var filepath = $('input.filepath').val(); + var filename = _.extractFilename(filepath)[1]; + var placeholder = 'Updated ' + filename; + if (app.state.mode === 'new') placeholder = 'Created ' + filename; - $('.button.save', this.el) - .html($('.button.save', this.el) - .hasClass('confirm') ? - (this.writable ? 'Commit' : 'Send Change Request') : - (this.writable ? 'Save' : 'Submit Change')); + $('.confirm', this.el) + .html($('.button.save', this.el) + .hasClass('confirm') ? + (this.writable ? 'Commit' : 'Send Change Request') : + (this.writable ? 'Save' : 'Submit Change')); - $message.attr('placeholder', placeholder).focus(); + $message.attr('placeholder', placeholder).focus(); + } return false; }, cancelSave: function(e) { - $('.commit', this.el).toggleClass('active', false); - $('.button.save', this.el).toggleClass('confirm', false); this.eventRegister.trigger('cancelSave', e); return false; }, diff --git a/src/prose/views/post.js b/src/prose/views/post.js index 017c2aef3..8c1f4d2e2 100644 --- a/src/prose/views/post.js +++ b/src/prose/views/post.js @@ -89,7 +89,6 @@ module.exports = Backbone.View.extend({ this.eventRegister.bind('remove', this.remove); this.eventRegister.bind('cancelSave', this.cancelSave); - this.eventRegister.trigger('sidebarContext', this.data); this.renderHeading(); var tmpl = _(window.app.templates.post).template(); @@ -143,7 +142,9 @@ module.exports = Backbone.View.extend({ title: _.filepath(this.data.path, this.data.file), writable: this.model.writable, alterable: true, - translate: this.data.translate + translate: this.data.translate, + lang: this.data.lang, + metadata: this.data.metadata }; this.eventRegister.trigger('headerContext', this.header, true); @@ -470,11 +471,6 @@ module.exports = Backbone.View.extend({ view.model.persisted = true; view.model.file = filename; - if (app.state.mode === 'new') { - app.state.mode = 'edit'; - view.eventRegister.trigger('sidebarContext', view.data); - } - view.renderHeading(); view.updateURL(); view.prevFile = filecontent; diff --git a/templates/app.html b/templates/app.html index 5341c1429..f0d05e933 100644 --- a/templates/app.html +++ b/templates/app.html @@ -52,7 +52,7 @@
  • - + Save
  • diff --git a/templates/settings.html b/templates/settings.html index 1bc2438f3..ff5398493 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1,20 +1,8 @@ <% if (window.authenticated) { %>
    -

    Post Settings

    +

    Post Options

    -
    -

    Describe you changes

    - - - Cancel - -
    - - - <%= writable ? 'Save' : 'Submit Change' %> - - <% if (app.state.config && app.state.config.languages && lang !== 'yaml') { %> <% _(app.state.config.languages).each(function(lang) { %> <% if (lang.value && (metadata && metadata.lang !== lang.value)) { %> diff --git a/templates/sidebarSave.html b/templates/sidebarSave.html new file mode 100644 index 000000000..c827e28df --- /dev/null +++ b/templates/sidebarSave.html @@ -0,0 +1,12 @@ +<% if (window.authenticated) { %> +
    +

    Describe your Changes

    +
    +
    +
    + +
    + + Save +
    +<% } %>