From: Łukasz Rekucki Date: Tue, 29 Sep 2009 14:13:49 +0000 (+0200) Subject: Merge branch 'master' of stigma:platforma X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/927a991b71d9876995dd2beadee8d9ff16175a50?hp=51d914bc0007135058a61623a2d057d2a7626a28 Merge branch 'master' of stigma:platforma --- diff --git a/project/static/css/html.css b/project/static/css/html.css new file mode 100644 index 00000000..85734491 --- /dev/null +++ b/project/static/css/html.css @@ -0,0 +1,222 @@ +.htmlview { + font-size: 16px; + font: Georgia, "Times New Roman", serif; + line-height: 1.5em; + margin: 0; + margin: 3em; + max-width: 36em; +} + +.htmlview #toc { + display: none; +} + +.htmlview a { + color: blue; + text-decoration: none; +} + +.htmlview h1 { + font-size: 3em; + margin: 1.5em 0; + text-align: center; + line-height: 1.5em; + font-weight: bold; +} + +.htmlview h2 { + font-size: 2em; + margin: 1.5em 0 0; + font-weight: bold; + line-height: 1.5em; +} + +.htmlview h3 { + font-size: 1.5em; + margin: 1.5em 0 0; + font-weight: normal; + line-height: 1.5em; +} + +.htmlview h4 { + font-size: 1em; + margin: 1.5em 0 0; + line-height: 1.5em; +} + +.htmlview p { + margin: 0; +} + +/* ======================== */ +/* = Footnotes and themes = */ +/* ======================== */ +.htmlview .theme-begin { + border-left: 0.1em solid #DDDDDD; + color: #777; + padding: 0 0.5em; + width: 7.5em; + font-style: normal; + font-weight: normal; + font-size: 16px; + float: right; + margin-right: -9.5em; + clear: both; + left: 40em; + line-height: 1.5em; + text-align: left; +} + +.htmlview .annotation { + font-style: normal; + font-weight: normal; + font-size: 12px; +} + +.htmlview #footnotes .annotation { + display: block; + float: left; + width: 2.5em; + clear: both; +} + +.htmlview #footnotes div { + margin: 1.5em 0 0 0; +} + +.htmlview #footnotes p { + margin-left: 2.5em; + font-size: 0.875em; +} + +.htmlview blockquote { + font-size: 0.875em; +} + +/* ============= */ +/* = Numbering = */ +/* ============= */ +.htmlview .anchor { + position: absolute; + margin: -0.25em -0.5em; + left: 1em; + color: #777; + font-size: 12px; + width: 2em; + text-align: center; + padding: 0.25em 0.5em; + line-height: 1.5em; +} + +.htmlview .anchor:hover, .htmlview .anchor:active { + color: #FFF; + background-color: #CCC; +} + +/* =================== */ +/* = Custom elements = */ +/* =================== */ +.htmlview span.author { + font-size: 0.5em; + display: block; + line-height: 1.5em; + margin-bottom: 0.25em; +} + +.htmlview span.collection { + font-size: 0.375em; + display: block; + line-height: 1.5em; + margin-bottom: -0.25em; +} + +.htmlview span.subtitle { + font-size: 0.5em; + display: block; + line-height: 1.5em; + margin-top: -0.25em; +} + +.htmlview div.didaskalia { + font-style: italic; + margin: 0.5em 0 0 1.5em; +} + +.htmlview div.kwestia { + margin: 0.5em 0 0; +} + +.htmlview div.stanza { + margin: 1.5em 0 0; +} + +.htmlview div.kwestia div.stanza { + margin: 0; +} + +.htmlview p.paragraph { + text-align: justify; + margin: 1.5em 0 0; +} + +.htmlview p.motto { + text-align: justify; + font-style: italic; + margin: 1.5em 0 0; +} + +.htmlview p.motto_podpis { + font-size: 0.875em; + text-align: right; +} + +.htmlview div.fragment { + border-bottom: 0.1em solid #999; + padding-bottom: 1.5em; +} + +.htmlview div.note p, .htmlview div.dedication p, +.htmlview div.note p.paragraph, .htmlview div.dedication p.paragraph { + text-align: right; + font-style: italic; +} + +.htmlview hr.spacer { + height: 3em; + visibility: hidden; +} + +.htmlview hr.spacer-line { + margin: 1.5em 0; + border: none; + border-bottom: 0.1em solid #000; +} + +.htmlview p.spacer-asterisk { + padding: 0; + margin: 1.5em 0; + text-align: center; +} + +.htmlview div.person-list ol { + list-style: none; + padding: 0 0 0 1.5em; +} + +.htmlview p.place-and-time { + font-style: italic; +} + +.htmlview em.math, .htmlview em.foreign-word, +.htmlview em.book-title, .htmlview em.didaskalia { + font-style: italic; +} + +.htmlview em.author-emphasis { + letter-spacing: 0.1em; +} + +.htmlview em.person { + font-style: normal; + font-variant: small-caps; +} diff --git a/project/static/js/models.js b/project/static/js/models.js index d0de300e..62d1c783 100644 --- a/project/static/js/models.js +++ b/project/static/js/models.js @@ -104,6 +104,7 @@ Editor.XMLModel = Editor.Model.extend({ this.set('state', 'dirty'); }, + // For debbuging set: function(property, value) { if (property == 'state') { console.log(this.description(), ':', property, '=', value); @@ -162,7 +163,8 @@ Editor.HTMLModel = Editor.Model.extend({ this.set('data', data); this.set('state', 'synced'); }, - + + // For debbuging set: function(property, value) { if (property == 'state') { console.log(this.description(), ':', property, '=', value); @@ -253,22 +255,47 @@ Editor.DocumentModel = Editor.Model.extend({ contentModelStateChanged: function(property, value, contentModel) { if (value == 'dirty') { + this.set('state', 'dirty'); for (var key in this.contentModels) { if (this.contentModels[key].guid() != contentModel.guid()) { - // console.log(this.contentModels[key].description(), 'frozen'); this.contentModels[key].set('state', 'unsynced'); } } + } else if (value == 'updated') { + this.set('state', 'synced'); + for (key in this.contentModels) { + if (this.contentModels[key].guid() == contentModel.guid()) { + this.contentModels[key].set('state', 'synced'); + } else if (this.contentModels[key].get('state') == 'unsynced') { + this.contentModels[key].set('state', 'empty'); + } + } } }, - quickSave: function(message) { + saveDirtyContentModel: function(message) { for (var key in this.contentModels) { if (this.contentModels[key].get('state') == 'dirty') { this.contentModels[key].update(message); break; } } + }, + + update: function() { + + }, + + merge: function() { + + }, + + // For debbuging + set: function(property, value) { + if (property == 'state') { + console.log(this.description(), ':', property, '=', value); + } + return this._super(property, value); } }); diff --git a/project/static/js/views/editor.js b/project/static/js/views/editor.js index 27b17cbf..04e22c86 100644 --- a/project/static/js/views/editor.js +++ b/project/static/js/views/editor.js @@ -9,29 +9,125 @@ var EditorView = View.extend({ this._super(element, model, template); this.model.load(); - $('#action-quick-save', this.element).bind('click.editorview', this.quickSave.bind(this)); - $('#action-commit', this.element).bind('click.editorview', this.commit.bind(this)); - $('#action-update', this.element).bind('click.editorview', this.update.bind(this)); - this.freeze('Ładowanie'); + this.quickSaveButton = $('#action-quick-save', this.element).bind('click.editorview', this.quickSave.bind(this)); + this.commitButton = $('#action-commit', this.element).bind('click.editorview', this.commit.bind(this)); + this.updateButton = $('#action-update', this.element).bind('click.editorview', this.update.bind(this)); + this.mergeButton = $('#action-merge', this.element).bind('click.editorview', this.merge.bind(this)); + + this.model.addObserver(this, 'state', this.modelStateChanged.bind(this)); + this.modelStateChanged('state', this.model.get('state')); + + // Inicjalizacja okien jQuery Modal + $('#commit-dialog', this.element). + jqm({ + modal: true, + onShow: this.loadRelatedIssues.bind(this) + }); + + $('#commit-dialog-cancel-button', this.element).click(function() { + $('#commit-dialog-error-empty-message').hide(); + $('#commit-dialog').jqmHide(); + }); + + // $('#split-dialog').jqm({ + // modal: true, + // onShow: $.fbind(self, self.loadSplitDialog) + // }). + // jqmAddClose('button.dialog-close-button'); }, quickSave: function(event) { - console.log('quickSave'); - this.model.quickSave(); + this.model.updateDirtyContentModel(); }, commit: function(event) { - console.log('commit'); + $('#commit-dialog', this.element).jqmShow({callback: this.doCommit.bind(this)}); + }, + + doCommit: function(message) { + this.model.saveDirtyContentModel(message); }, update: function(event) { - console.log('update'); + this.model.update(); + }, + + merge: function(event) { + $('#commit-dialog', this.element).jqmShow({callback: this.doMerge.bind(this)}); + }, + + doMerge: function(message) { + this.model.merge(message); + }, + + loadRelatedIssues: function(hash) { + var self = this; + var c = $('#commit-dialog-related-issues'); + + $('#commit-dialog-save-button').click(function(event, data) + { + if ($('#commit-dialog-message').val().match(/^\s*$/)) { + $('#commit-dialog-error-empty-message').fadeIn(); + } else { + $('#commit-dialog-error-empty-message').hide(); + $('#commit-dialog').jqmHide(); + + var message = $('#commit-dialog-message').val(); + $('#commit-dialog-related-issues input:checked') + .each(function() { message += ' refs #' + $(this).val(); }); + console.log("COMMIT APROVED", hash.t); + hash.t.callback(message); + } + return false; + }); + + $("div.loading-box", c).show(); + $("div.fatal-error-box", c).hide(); + $("div.container-box", c).hide(); + + $.getJSON(c.attr('ui:ajax-src') + '?callback=?', + function(data, status) + { + var fmt = ''; + $(data).each( function() { + fmt += '\n'; + }); + $("div.container-box", c).html(fmt); + $("div.loading-box", c).hide(); + $("div.container-box", c).show(); + }); + + hash.w.show(); + }, + + modelStateChanged: function(property, value) { + // Uaktualnia stan przycisków + if (value == 'dirty') { + this.quickSaveButton.attr('disabled', null); + this.commitButton.attr('disabled', null); + this.updateButton.attr('disabled', 'disabled'); + this.mergeButton.attr('disabled', 'disabled'); + } else if (value == 'synced') { + this.quickSaveButton.attr('disabled', 'disabled'); + this.commitButton.attr('disabled', 'disabled'); + this.updateButton.attr('disabled', null); + this.mergeButton.attr('disabled', null); + } else if (value == 'empty') { + this.quickSaveButton.attr('disabled', 'disabled'); + this.commitButton.attr('disabled', 'disabled'); + this.updateButton.attr('disabled', 'disabled'); + this.mergeButton.attr('disabled', 'disabled'); + } }, dispose: function() { $('#action-quick-save', this.element).unbind('click.editorview'); $('#action-commit', this.element).unbind('click.editorview'); $('#action-update', this.element).unbind('click.editorview'); + $('#action-merge', this.element).unbind('click.editorview'); + + this.model.removeObserver(this); this._super(); } }); diff --git a/project/static/js/views/xml.js b/project/static/js/views/xml.js index 6b7571a3..8af3c4d4 100644 --- a/project/static/js/views/xml.js +++ b/project/static/js/views/xml.js @@ -58,7 +58,6 @@ var XMLView = View.extend({ }, modelDataChanged: function(property, value) { - console.log('modelDataChanged'); if (this.editor.getCode() != value) { this.editor.setCode(value); } diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index 7cb23a7b..de1e2420 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -1,12 +1,16 @@ {% extends "base.html" %} {% block extrahead %} + + - + {# Libraries #} + + {# Scriptlets #} @@ -106,7 +110,7 @@ {% endblock %} {% block header-toolbar %} - + {% endblock %} {% block maincontent %} @@ -116,35 +120,35 @@ - {#
#} - {#
#} - {# #} - {# #} - {#

Wiadomość nie może być pusta.

#} - {# #} - {#

#} - {# #} - {# #} - {#

#} - {#
#} - {#
#} - {# #} - {#
#} - {#
#} - {# #} - {# #} - {#
#} + + + {% endblock maincontent %}