зеркало из https://github.com/mozilla/FlightDeck.git
flightdeck editor extension / capability edit fix
This commit is contained in:
Родитель
7f9d38433b
Коммит
fec6e2e1a9
|
@ -10,12 +10,11 @@
|
|||
<script src="/media/js/lib/mootools-1.2.4.4-more.js"></script>
|
||||
<script src="/media/roar/Roar.js"></script>
|
||||
<script src="/media/jetpack/js/Sidebar.js"></script>
|
||||
{% block head %}
|
||||
{% endblock %}
|
||||
{% block roar_css %}<link href="/media/roar/Roar.css" rel="stylesheet" type="text/css">{% endblock %}
|
||||
<script src="/media/js/FlightDeck.js"></script>
|
||||
<script src="/media/js/FlightDeck.Roar.js"></script>
|
||||
<script src="/media/js/FlightDeck.Modal.js"></script>
|
||||
{% block head %}{% endblock %}
|
||||
{% block roar_css %}<link href="/media/roar/Roar.css" rel="stylesheet" type="text/css">{% endblock %}
|
||||
<script type='text/javascript'>
|
||||
var fd;
|
||||
window.addEvent('domready', function() {
|
||||
|
|
|
@ -62,36 +62,13 @@ var Capability = new Class({
|
|||
*/
|
||||
instantiateEditors: function() {
|
||||
// do not create an editor for the description if loaded as dependency
|
||||
if (! this.options.is_dependency) {
|
||||
this.description_el = new Editor(this.options.description_el).hide();
|
||||
fd.editors.push(this.description_el);
|
||||
}
|
||||
this.description_el = new Editor(this.options.description_el).hide();
|
||||
fd.editors.push(this.description_el);
|
||||
},
|
||||
/*
|
||||
* Method: initializeEditorSwitches
|
||||
*/
|
||||
initializeEditorSwitches: function() {
|
||||
// TODO: this should be done with the event broadcast
|
||||
// to not bother about new dependencies added
|
||||
var switch_mode_on = function() {
|
||||
$$('.UI_File_Selected').each(function(el) {
|
||||
el.switch_mode_off();
|
||||
});
|
||||
this.removeClass('UI_File_Normal')
|
||||
.addClass('UI_File_Selected')
|
||||
};
|
||||
var switch_mode_off = function() {
|
||||
this.removeClass('UI_File_Selected')
|
||||
.addClass('UI_File_Normal')
|
||||
}
|
||||
$$('.UI_File_Listing li').each(function(file_el) {
|
||||
file_el.switch_mode_on = switch_mode_on;
|
||||
file_el.switch_mode_off = switch_mode_off;
|
||||
});
|
||||
$$('.UI_File_Listing li a').addEvent('click', function() {
|
||||
this.getParent('li').switch_mode_on();
|
||||
});
|
||||
|
||||
this.switch_description_el = $(this.options.switch_description_id);
|
||||
if (this.switch_description_el) {
|
||||
this.switch_description_el.addEvent('click', this.switchToDescription.bind(this));
|
||||
|
@ -100,7 +77,7 @@ var Capability = new Class({
|
|||
/*
|
||||
* Method: switchToDescription
|
||||
*/
|
||||
switchToDescription: function() {
|
||||
switchToDescription: function(e) {
|
||||
fd.hideEditors();
|
||||
this.description_el.show();
|
||||
},
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Extending Flightdeck with Editor functionality
|
||||
*/
|
||||
|
||||
FlightDeck = Class.refactor(FlightDeck,{
|
||||
options: {
|
||||
file_selected_class: 'UI_File_Selected',
|
||||
file_normal_class: 'UI_File_Normal',
|
||||
file_listing_class: 'UI_File_Listing'
|
||||
},
|
||||
initialize: function(options) {
|
||||
this.setOptions(options);
|
||||
this.previous(options);
|
||||
var file_selected_class = this.options.file_selected_class;
|
||||
var file_normal_class = this.options.file_normal_class;
|
||||
var switch_mode_on = function() {
|
||||
console.log('yeah');
|
||||
$$('.' + file_selected_class).each(function(el) {
|
||||
el.switch_mode_off();
|
||||
});
|
||||
this.removeClass(file_normal_class)
|
||||
.addClass(file_selected_class);
|
||||
};
|
||||
var switch_mode_off = function() {
|
||||
this.removeClass(file_selected_class)
|
||||
.addClass(file_normal_class);
|
||||
};
|
||||
$$('.'+this.options.file_listing_class + ' li').each(function(file_el) {
|
||||
file_el.switch_mode_on = switch_mode_on;
|
||||
file_el.switch_mode_off = switch_mode_off;
|
||||
});
|
||||
$$('.'+this.options.file_listing_class).each(function(container) {
|
||||
container.addEvent('relay:click(li a)', function(e, el) {
|
||||
console.log(el);
|
||||
$(el).getParent('li').switch_mode_on();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
item = new Capability({
|
||||
slug: '{{ capability.slug }}',
|
||||
name: '{{ capability.name }}',
|
||||
description: '{{ capability.description }}',
|
||||
description: '{{ capability.description|escapejs }}',
|
||||
creator: '{{ capability.creator }}',
|
||||
edit_url: '{{ capability.get_absolute_url }}',
|
||||
update_url: '{{ capability.get_update_url }}',
|
||||
|
@ -20,8 +20,8 @@
|
|||
version: {
|
||||
author: '{{ version.author }}',
|
||||
name: '{{ version.name }}',
|
||||
description: '{{ version.description }}',
|
||||
content: '{{ version.content }}',
|
||||
description: '{{ version.description|escapejs }}',
|
||||
content: '{{ version.content|escapejs }}',
|
||||
is_base: {{ version.is_base|yesno:"true,false" }},
|
||||
edit_url: '{{ version.get_absolute_url }}',
|
||||
update_url: '{{ version.get_update_url }}',
|
||||
|
@ -61,20 +61,13 @@
|
|||
<span class="UI_OC"></span>
|
||||
<span class="UI_Sidebar_Toggler_Icon"></span>
|
||||
</a></h3>
|
||||
|
||||
<div class="UI_Sidebar_ItemCont">
|
||||
<ul class="UI_File_Listing">
|
||||
{% for cap in version.capabilities.all %}
|
||||
<li class="UI_File_Normal" id="{{ cap|dependency_link_id }}">
|
||||
<a title="{{ cap.name }}" href="#">{{ cap.name }} <span></span></a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% include "_dependency_list.html" %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="info" class="UI_Side_Item">
|
||||
<h3 class="UI_Sidebar_Toggler info opened closed"><a title="Info" href="#">
|
||||
<h3 class="UI_Sidebar_Toggler info opened"><a title="Info" href="#">
|
||||
Info
|
||||
<span class="UI_OC"></span>
|
||||
<span class="UI_Sidebar_Toggler_Icon"></span>
|
||||
|
@ -131,7 +124,10 @@
|
|||
{% include "_editor_menu.html" %}
|
||||
<div id="editor-wrapper">
|
||||
<textarea id="capability_description" name="capability_description" class="UI_Editor_Area bespin">{{ capability.description }}</textarea>
|
||||
<textarea id="version_content" name="version_content" class="UI_Editor_Area bespin" data-bespinoptions='{"stealFocus":true}'>{{ version.content }}</textarea>
|
||||
<textarea id="version_content" name="version_content" class="UI_Editor_Area bespin">{{ version.content }}</textarea>
|
||||
<textarea id="version_description" name="version_description" class="UI_Editor_Area bespin">{{ version.description }}</textarea>
|
||||
{% for cap in version.capabilities.all %}
|
||||
<textarea id="dependency_content_{{ cap.slug }}" class="UI_Editor_Area" name="dependency_content_{{ cap.slug }}">{{ cap.version.content }}</textarea>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
{% load jetpack_extras %}
|
||||
{% block head %}
|
||||
<link rel="stylesheet" href="/media/jetpack/css/UI.Editor.css" type="text/css" media="screen">
|
||||
<script src="/media/jetpack/js/FlightDeck.Editor.js"></script>
|
||||
<script src="/media/jetpack/js/Create.js"></script>
|
||||
<script src="/media/jetpack/js/Editor.js"></script>
|
||||
<script src="/media/jetpack/js/Capability.js"></script>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
</section>
|
||||
|
||||
<section id="info" class="UI_Side_Item">
|
||||
<h3 class="UI_Sidebar_Toggler info opened closed"><a title="Info" href="#">
|
||||
<h3 class="UI_Sidebar_Toggler info opened"><a title="Info" href="#">
|
||||
Info
|
||||
<span class="UI_OC"></span>
|
||||
<span class="UI_Sidebar_Toggler_Icon"></span>
|
||||
|
|
Загрузка…
Ссылка в новой задаче