Merge remote-tracking branch 'origin/master' into rails_3_1

Conflicts:
	app/models/content_instance.rb
	config/locales/admin_ui.de.yml
	public/javascripts/admin/inline_editor_toolbar.js
	spec/models/content_instance_spec.rb
This commit is contained in:
Mario Visic 2012-01-15 00:02:46 +10:30
commit 8ac8289394
30 changed files with 487 additions and 26 deletions

View File

@ -299,7 +299,7 @@ DEPENDENCIES
codemirror-rails
coffee-script (~> 2.2.0)
compass (~> 0.12.alpha.4)
cucumber-rails (= 1.2.0)
cucumber-rails
custom_fields!
database_cleaner
delayed_job_mongoid (~> 1.0.8)

View File

@ -45,6 +45,20 @@ h2. Community
* Join us on IRC "#locomotivecms at irc.freenode.net!":http://webchat.freenode.net/
* "Follow us on twitter":http://twitter.com/locomotiveapp
h2. Contributing to Locomotive
Locomotive CMS is an open source project, we encourage contributions. If you have found a bug and want to contribute a fix, or have a new feature you would like to add, follow the steps below to get your patch into the project:
* Install ruby and mongoDB
* Clone the project <code>git clone git@github.com:locomotivecms/engine.git</code>
* Setup a virtual host entry for <code>test.example.com</code> to point to localhost
* Run the tests <code>rake</code>
* Write your failing tests
* Make the tests pass
* "Create a GitHub pull request":http://help.github.com/send-pull-requests
For new features (especially large ones) it is best to create a topic on the "discussion forums":http://locomotive.vanillaforums.com/ first to make sure it fits into the goals of the project.
h2. Team
* Developers: "Didier Lafforgue":http://www.nocoffee.fr, "Jacques Crocker":http://www.railsjedi.com, "Mario Visic":http://www.mariovisic.com

View File

@ -15,9 +15,9 @@ de:
header:
welcome: Willkommen, %{name}
see: Webseite ansehen
switch: Mandant wechseln
logout: Ausloggen
switch: Zu anderer Seite wechseln
help: Hilfe
logout: Ausloggen
menu:
contents: Inhalte
assets: Galerien
@ -49,11 +49,11 @@ de:
notifications:
new_content_entry:
subject: "[%{type}] neu"
title: "Hi %{firstname}, nur damit du Bescheid weißt! Am %{date} wurde folgende neue Instanz erstellt."
title: "Hi %{name}, nur damit du Bescheid weißt! Am %{date} wurde folgende neue Instanz erstellt."
type: "Model: %{type}"
sites_picker:
new: + Neuer Mandant
new: + Neue Webseite
custom_fields:
edit:
@ -189,10 +189,9 @@ de:
edit:
title: "Bearbeite %{file}"
help: "Diese Datei kann über folgende URL erreicht werden: <a href='%{url}'>%{url}</a>"
help_image: "Das Bild kann über den folgenden Liquid Code in Seitenvorlagen oder Snipplets eingebunden werden: <span class='code'>{{ '%{path}' | theme_image_tag }}</span>.<br/>Die aktuelle Bildgröße ist: <b>%{width}px x %{height}px</b>.<br/>"
help_javascript: "Die Javascript Datei kann über den folgenden Liquid Code in Seitenvorlagen oder Snipplets eingebunden werden: <span class='code'>{{ '%{path}' | javascript_tag }}</span>.<br/>"
help_stylesheet: "Die Stylesheet Datei kann über den folgenden Liquid Code in Seitenvorlagen oder Snipplets eingebunden werden: <span class='code'>{{ '%{path}' | stylesheet_tag }}</span>.<br/>"
help_image: "Du kannst das Bild in Templates oder Snippets mit folgendem Code einbinden : <span class='code'>{{ '%{path}' | theme_image_tag }}</span>.<br/>Aktuelle Breite x Höhe : <b>%{width}px x %{height}px</b>.<br/>"
help_javascript: "Du kannst die Javascript Datei in Templates oder Snippets mit folgendem Code einbinden: <span class='code'>{{ '%{path}' | javascript_tag }}</span>.<br/>"
help_stylesheet: "Du kannst die CSS Datei in Templates oder Snippets mit folgendem Code einbinden : <span class='code'>{{ '%{path}' | stylesheet_tag }}</span>.<br/>"
form:
picker_link: Füge eine Datei in den Code ein
choose_file: Datei auswählen
@ -292,19 +291,20 @@ de:
installation:
common:
title: Locomotive CMS Initialisierung
title: Erst-Installation von Locomotive CMS
next: Weiter
step_1:
title: "Schritt 1/2 &mdash; Zugang erstellen"
name: Nachname
firstname: Vorname
email: Email
title: "Schritt 1/2 &mdash; Account erstellen"
name: Name
email: E-Mail
password: Passwort
password_confirmation: Passwort-Bestätigung
done: "Du hast bereits einen Zugang erstellt:<br/><strong>%{name}</strong>, <em>%{email}</em>"
next: Zugang erstellen
done: "Du hast bereits einen Account hinzugefügt:<br/><strong>%{name}</strong>, <em>%{email}</em>"
next: Account erstellen
step_2:
title: "Schritt 2/2 &mdash; Webseite erstellen"
explanations: "Wenn Du schon ein Standard Template hochgeladen hast (siehe Hilfe), kannst Du es gleich benutzen. Oder Du kannst ein fertiges Template als zip-Datei hochladen. <a href='http://www.locomotivecms.com/support/themes'>Hier</a> findest du ein paar kostenlose Templates, die du gerne kostenlos verwenden kannst."
back_to_default_template: "Klicken Sie <a href='#'>hier</a> um die Standardvorlage zu verwenden."
explanations: |
Wenn Du schon eine ein Standard Template hochgeladen hast (siehe Hilfe), kannst Du es gleich benutzen.
Oder Du kannst ein fertiges Template als zip-Datei hochladen. <a href='http://www.locomotivecms.com/support/themes'>Hier</a> findest du ein paar kostenlose Templates, die du gerne kostenlos verwenden kannst.
back_to_default_template: "Klick <a href='#'>hier</a> um ein Template auszuwählen"
next: Webseite erstellen

View File

@ -109,7 +109,7 @@ de:
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
abbr_month_names: [~, Jan., Feb., Mär., Apr., Mai, Juni, Juli, Aug., Sept., Okt., Nov., Dez.]
order: [ :day, :month, :year ]
order: [ day, month, year ]
pagination:
previous: "&laquo; Zurück"

View File

@ -116,7 +116,7 @@ es:
abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab]
month_names: [~, Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Setiembre, Octubre, Noviembre, Diciembre]
abbr_month_names: [~, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Set, Oct, Nov, Dic]
order: [ :year, :month, :day ]
order: [ year, month, day ]
time:
formats:

View File

@ -115,7 +115,7 @@ fr:
abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
order: [ :day, :month, :year ]
order: [ day, month, year ]
pagination:
previous: "&laquo; Précédent"

View File

@ -121,7 +121,7 @@ it:
abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]
month_names: [~, Gennaio, Febbraio, Marzo, Aprile, Maggio, Giugno, Luglio, Agosto, Settembre, Ottobre, Novembre, Dicembre]
abbr_month_names: [~, Gen, Feb, Mar, Apr, Mag, Giu, Lug, Ago, Set, Ott, Nov, Dic]
order: [ :day, :month, :year ]
order: [day, month, year]
time:
formats:

View File

@ -110,7 +110,7 @@ pt-BR:
month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
order: [ :day, :month, :year ]
order: [day, month, year]
time:

View File

@ -78,7 +78,6 @@ de:
source: "Die aktuelle Datei liegt hier %{url}"
update:
source: "Die aktuelle Datei liegt hier %{url}"
custom_fields:
field:
name: "Merkmal verfügbar in den liquid-Templates"
@ -93,6 +92,6 @@ de:
samples: "Bei Aktivierung werden auch Inhalte und Assets importiert"
reset: "Bei Aktivierung werden alle Daten deiner Webseite gelöscht, bevor die neue Webseite importiert wird"
content_type:
item_template: "Du kannst den Text für jeden Baustein einfach anpassen. Benutze einfach folgendes in Liquid : ({{ content.name }})"
item_template: "Du kannst den Text für jeden Baustein einfach anpassen. Benutze einfach folgendes in Liquid : {{ content.name }})"
api_enabled: "Dies wird genutzt, um Besuchern deiner Webseite die Möglichkeit zu geben neue Elemente zu erstellen (z.B: Nachrichten in einem Kontakt-Formular)"
api_accounts: "Sobald ein Besucher ein neues Element erstellt, wird eine Benachrichtigungs-Email an alle unten aufgeführten Accounts gesendet"

View File

@ -191,7 +191,7 @@ module Locomotive
content = content._parent.reload.contents.find(content._id) # target should be updated
associations.each do |association|
target_content_type = site.content_types.where(:name => association.target).first
target_content_type = site.content_types.where(:slug => association.target).first
next if target_content_type.nil?

View File

@ -0,0 +1,209 @@
var InlineEditorToolbar = {
element: null, // reference to the toolbar element
form: null, // reference to the form used to post changes
editingMode: false, // true means that Aloha should be enabled
drawerButton: null,
locale: 'en', // default locale
initialize: function() {
this.editingMode = window.location.href.match(/\/edit$/) != null;
this.locale = $('meta[name=locale]').attr('content');
this._buildHTML();
this.element = $('#page-toolbar');
this.form = this.element.find('form');
this.drawerButton = this.element.find('.drawer a');
this._bindEvents();
if ($.cookie('ie_toolbar_off') == '1') this.hide(0, false);
},
toggle: function(animate) {
var duration = (typeof animate == 'undefined') || animate == true ? 300 : 0;
if (this.drawerButton.hasClass('off')) this.show(duration); else this.hide(duration);
},
show: function(duration, withCookie) {
var self = this;
this.element.animate({ 'right': 0 }, duration, function() {
self.drawerButton.removeClass('off');
if ((typeof withCookie == 'undefined') || withCookie == true)
$.cookie('ie_toolbar_off', '0');
});
},
hide: function(duration, withCookie) {
var self = this;
var max = this.element.width() - 17;
this.element.animate({ 'right': -max }, duration, function() {
self.drawerButton.addClass('off');
if ((typeof withCookie == 'undefined') || withCookie == true)
$.cookie('ie_toolbar_off', '1');
});
},
updateForm: function(jEvent, aEvent) {
InlineEditorToolbar.element.find('li.save, li.cancel, li.sep:eq(1)').show();
var content = aEvent.editable.getContents().replace(/^\s*/, "").replace(/\s*$/, "");
var editableObj = $(aEvent.editable.obj[0]);
var dataId = editableObj.attr('data-element-id');
var idInput = InlineEditorToolbar.form.find('#editable-id');
var contentInput = InlineEditorToolbar.form.find('#editable-content');
idInput.attr('name', 'page[editable_elements_attributes][0][id]').val(dataId);
contentInput.attr('name', 'page[editable_elements_attributes][0][content]').val(content);
InlineEditorToolbar.show(true, false);
},
displaySpinner: function() {
this.element.find('li.save, li.cancel, li.sep:eq(1)').hide();
this.element.find('.spinner').show();
},
resetForm: function() {
this.form.find('input.auto').each(function() {
$(this).attr('name', $(this).attr('name').replace('content', '_index'));
$(this).val('');
});
this.element.find('li.save, li.cancel, li.sep:eq(1), li.spinner').hide();
},
/* ___ internal methods ___ */
_buildHTML: function() {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
var labels = this._translations[this.locale];
var showPageUrl = $('meta[name=page-url]').attr('content');
var editPageUrl = $('meta[name=edit-page-url]').attr('content');
var nbElements = parseInt($('meta[name=page-elements-count]').attr('content'));
var formContentHTML = "<input type='hidden' name='_method' value='put' />\
<input class='auto' id='editable-id' type='hidden' name='_id' value='' />\
<input class='auto' id='editable-content' type='hidden' name='_content' value='' />";
if (csrf_param != null && csrf_token != null) {
formContentHTML += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
}
$('body').prepend("<div id='page-toolbar'>\
<ul>\
<li class='drawer'><a href='#'><span>&nbsp;</span></a></li>\
<li class='link home'><a href='" + editPageUrl + "'><span>" + labels['home'] + "</span></a></li>\
<li class='sep'><span>&nbsp;</span></li>\
<li class='link edit' style='" + (this.editingMode ? 'display: none' : '') + "'><a href='#'><span>" + labels['edit'] + "</span></a></li>\
<li class='link save' style='display: none'><a href='#'><span>" + labels['save'] + "</span></a></li>\
<li class='link cancel' style='display: none'><a href='#'><span>" + labels['cancel'] + "</span></a></li>\
<li class='link spinner' style='display: none'><a href='#'><span><img src='/images/admin/form/spinner.gif' /><em>" + labels['saving'] + "</em></span></a></li>\
<li class='sep' style='display: none'><span>&nbsp;</span></li>\
<li class='link back' style='" + (this.editingMode ? '' : 'display: none') + "'><a href='#'><span>" + labels['back'] + "</span></a></li>\
</ul>\
<form action='" + showPageUrl + "' accept-charset='UTF-8' method='post'>\
" + formContentHTML + "\
</form>\
</div>");
},
_bindEvents: function() {
var self = this;
this.form.live('submit', function (e) { $(this).callRemote(); e.stopPropagation(); e.preventDefault();
}).bind('ajax:complete', function() { self.resetForm();
}).bind('ajax:loading', function() { self.displaySpinner();
}).bind('ajax:failure', function() { self.resetForm();
});
this.element.find('ul li a').click(function(e) {
var classArray = $(this).parent().attr('class').split(' ');
switch(classArray[1] || classArray[0]) {
case 'home':
window.location.href = $(this).attr('href'); break;
case 'edit': // passing in editing mode
var url = window.location.href.replace(/\/$/, '/index').replace('#', '');
window.location.href = url + '/edit'; break;
case 'save': // saving changes
self.form.submit(); break;
case 'cancel': // reload the page
window.location.href = window.location.href; break;
case 'back': // back to the non edition mode
var url = window.location.href.replace(/\/edit$/, '');
window.location.href = url; break;
case 'drawer': // expand / shrink toolbar
self.toggle(); break;
}
e.preventDefault(); e.stopPropagation();
});
},
_translations: {
'en': {
'home': 'admin',
'edit': 'edit',
'save': 'save',
'cancel': 'cancel',
'back': 'edition done',
'saving': 'saving'
},
'de': {
'home': 'admin',
'edit': 'bearbeiten',
'save': 'speichern',
'cancel': 'schließen',
'back': 'bearbeiten abschließen',
'saving': 'am Speichern'
},
'fr': {
'home': 'admin',
'edit': 'editer',
'save': 'sauver',
'cancel': 'annuler',
'back': 'fin mode edition',
'saving': 'sauvegarde en cours'
},
'pt-BR': {
'home': 'admin',
'edit': 'editar',
'save': 'salvar',
'cancel': 'cancelar',
'back': 'terminar edição',
'saving': 'salvando'
},
'it': {
'home': 'admin',
'edit': 'modifica',
'save': 'salva',
'cancel': 'annulla',
'back': 'fine modifica',
'saving': 'sto salvando'
},
'ru': {
'home': 'панель управления',
'edit': 'редактирование',
'save': 'сохранение',
'cancel': 'отмена',
'back': 'закончить редактирование',
'saving': 'сохранение'
}
}
};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.advhr_dlg',{size:"\u0412\u044b\u0441\u043e\u0442\u0430",noshade:"\u0411\u0435\u0437 \u0442\u0435\u043d\u0438",width:"\u0428\u0438\u0440\u0438\u043d\u0430",normal:"\u041e\u0431\u044b\u0447\u043d\u0430\u044f",widthunits:"\u0415\u0434\u0438\u043d\u0438\u0446\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f"});

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.advimage_dlg',{"image_list":"\u0421\u043f\u0438\u0441\u043e\u043a \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a","align_right":"\u041f\u043e \u043f\u0440\u0430\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e","align_left":"\u041f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e","align_textbottom":"\u041f\u043e \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e \u0442\u0435\u043a\u0441\u0442\u0430","align_texttop":"\u041f\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e \u0442\u0435\u043a\u0441\u0442\u0430","align_bottom":"\u041f\u043e \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e","align_middle":"\u041f\u043e \u0446\u0435\u043d\u0442\u0440\u0443","align_top":"\u041f\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e","align_baseline":"\u041f\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043b\u0438\u043d\u0438\u0438",align:"\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435",hspace:"\u0413\u043e\u0440\u0438\u0437. \u043e\u0442\u0441\u0442\u0443\u043f",vspace:"\u0412\u0435\u0440\u0442. \u043e\u0442\u0441\u0442\u0443\u043f",dimensions:"\u0420\u0430\u0437\u043c\u0435\u0440",border:"\u0413\u0440\u0430\u043d\u0438\u0446\u0430",list:"\u0421\u043f\u0438\u0441\u043e\u043a",alt:"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435",src:"\u0410\u0434\u0440\u0435\u0441","dialog_title":"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f","missing_alt":"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0431\u0435\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f? \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c.","example_img":"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f",misc:"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b",mouseout:"\u0412 \u043f\u043e\u043a\u043e\u0435",mouseover:"\u041f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438","alt_image":"\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435","swap_image":"\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",map:"\u041a\u0430\u0440\u0442\u0430 \u0441\u0441\u044b\u043b\u043e\u043a",id:"\u0418\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430",rtl:"\u0421\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e",ltr:"\u0421\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e",classes:"\u041a\u043b\u0430\u0441\u0441\u044b",style:"\u0421\u0442\u0438\u043b\u044c","long_desc":"\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435",langcode:"\u041a\u043e\u0434 \u044f\u0437\u044b\u043a\u0430",langdir:"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430","constrain_proportions":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438",preview:"\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440",title:"\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a",general:"\u041e\u0431\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b","tab_advanced":"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e","tab_appearance":"\u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435","tab_general":"\u041e\u0431\u0449\u0435\u0435",width:"\u0428\u0438\u0440\u0438\u043d\u0430",height:"\u0412\u044b\u0441\u043e\u0442\u0430"});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.emotions_dlg',{cry:"\u041f\u043b\u0430\u0447\u0443",cool:"\u041a\u0440\u0443\u0442\u043e\u0439",desc:"\u0421\u043c\u0430\u0439\u043b\u044b",title:"\u0412\u044b\u0431\u043e\u0440 \u0441\u043c\u0430\u0439\u043b\u0430",yell:"\u041a\u0440\u0438\u0447\u0443",wink:"\u041f\u043e\u0434\u043c\u0438\u0433\u0438\u0432\u0430\u044e",undecided:"\u0412 \u043d\u0435\u0440\u0435\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438","tongue_out":"\u0414\u0440\u0430\u0437\u043d\u044e\u0441\u044c",surprised:"\u0423\u0434\u0438\u0432\u043b\u044f\u044e\u0441\u044c",smile:"\u0423\u043b\u044b\u0431\u0430\u044e\u0441\u044c",sealed:"\u041d\u0435\u043c \u043a\u0430\u043a \u0440\u044b\u0431\u0430","money_mouth":"\u0414\u0435\u043d\u044c\u0433\u0438",laughing:"\u0421\u043c\u0435\u044e\u0441\u044c",kiss:"\u041f\u043e\u0446\u0435\u043b\u0443\u0439",innocent:"\u0410\u043d\u0433\u0435\u043b",frown:"\u0425\u043c\u0443\u0440\u044e\u0441\u044c","foot_in_mouth":"\u0412 \u0440\u043e\u0442 \u043c\u043d\u0435 \u043d\u043e\u0433\u0438",embarassed:"\u041a\u0440\u0430\u0441\u043d\u0435\u044e",usage:"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \"\u0412\u043b\u0435\u0432\u043e\" \u0438 \"\u0412\u043f\u0440\u0430\u0432\u043e\" \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438."});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
tinyMCE.addI18n('ru.locomedia_dlg',{
dialog_title: 'Вставить изображение', // Insert media
upload: 'Загрузить изображение', // Upload media
loading: 'Идет загрузка...', // Loading...
uploading: 'Идет загрузка...', // Uploading...
destroying: 'Идет удаление...', // Destroying...
confirm: 'Вы уверены?', // Are you sure ?
no_items: 'Список изображений пуск.' // There are no media for now.
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.paste_dlg',{"word_title":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 CTRL+V \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043e\u043a\u043d\u043e.","text_linebreaks":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b \u0441\u0442\u0440\u043e\u043a","text_title":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 CTRL+V \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043e\u043a\u043d\u043e."});

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.searchreplace_dlg',{findwhat:"\u041f\u043e\u0438\u0441\u043a",replacewith:"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430",direction:"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435",up:"\u0412\u0432\u0435\u0440\u0445 ",down:"\u0412\u043d\u0438\u0437",mcase:"\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440",findnext:"\u041d\u0430\u0439\u0442\u0438 \u0434\u0430\u043b\u0435\u0435",allreplaced:"\u0412\u0441\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u044b.","searchnext_desc":"\u041d\u0430\u0439\u0442\u0438 \u0435\u0449\u0435",notfound:"\u041f\u043e\u0438\u0441\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d. \u0421\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e.","search_title":"\u041f\u043e\u0438\u0441\u043a","replace_title":"\u041f\u043e\u0438\u0441\u043a \u0438 \u0437\u0430\u043c\u0435\u043d\u0430",replaceall:"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435",replace:"\u0417\u0430\u043c\u0435\u043d\u0430"});

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.style_dlg',{"text_lineheight":"\u0412\u044b\u0441\u043e\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0438","text_variant":"\u0412\u0430\u0440\u0438\u0430\u043d\u0442","text_style":"\u0421\u0442\u0438\u043b\u044c","text_weight":"\u0422\u043e\u043b\u0449\u0438\u043d\u0430","text_size":"\u0420\u0430\u0437\u043c\u0435\u0440","text_font":"\u0428\u0440\u0438\u0444\u0442","text_props":"\u0422\u0435\u043a\u0441\u0442","positioning_tab":"\u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435","list_tab":"\u0421\u043f\u0438\u0441\u043e\u043a","border_tab":"\u0413\u0440\u0430\u043d\u0438\u0446\u0430","box_tab":"\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440","block_tab":"\u0411\u043b\u043e\u043a","background_tab":"\u0424\u043e\u043d","text_tab":"\u0422\u0435\u043a\u0441\u0442",apply:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c",title:"\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 CSS \u0441\u0442\u0438\u043b\u044f",clip:"\u041e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435",placement:"\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435",overflow:"\u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435",zindex:"Z-\u0438\u043d\u0434\u0435\u043a\u0441",visibility:"\u0412\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c","positioning_type":"\u0422\u0438\u043f",position:"\u041f\u043e\u0437\u0438\u0446\u0438\u044f","bullet_image":"\u041c\u0430\u0440\u043a\u0435\u0440","list_type":"\u0422\u0438\u043f",color:"\u0426\u0432\u0435\u0442",height:"\u0412\u044b\u0441\u043e\u0442\u0430",width:"\u0428\u0438\u0440\u0438\u043d\u0430",style:"\u0421\u0442\u0438\u043b\u044c",margin:"\u041e\u0442\u0441\u0442\u0443\u043f",left:"\u0421\u043b\u0435\u0432\u0430",bottom:"\u0421\u043d\u0438\u0437\u0443",right:"\u0421\u043f\u0440\u0430\u0432\u0430",top:"\u0412\u0432\u0435\u0440\u0445",same:"\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445",padding:"\u041f\u043e\u043b\u044f","box_clear":"\u042f\u0432\u043d\u044b\u0439","box_float":"\u041f\u043b\u0430\u0432\u0430\u044e\u0449\u0438\u0439","box_height":"\u0412\u044b\u0441\u043e\u0442\u0430","box_width":"\u0428\u0438\u0440\u0438\u043d\u0430","block_display":"\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435","block_whitespace":"\u041f\u0440\u043e\u0431\u0435\u043b","block_text_indent":"\u041e\u0442\u0441\u0442\u0443\u043f \u0442\u0435\u043a\u0441\u0442\u0430","block_text_align":"\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430","block_vertical_alignment":"\u0412\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435","block_letterspacing":"\u041e\u0442\u0441\u0442\u0443\u043f\u044b \u043c\u0435\u0436\u0434\u0443 \u0431\u0443\u043a\u0432\u0430\u043c\u0438","block_wordspacing":"\u041e\u0442\u0441\u0442\u0443\u043f\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0432\u0430\u043c\u0438","background_vpos":"\u0412\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f","background_hpos":"\u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f","background_attachment":"\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430","background_repeat":"\u041f\u043e\u0432\u0442\u043e\u0440","background_image":"\u0424\u043e\u043d\u043e\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435","background_color":"\u0426\u0432\u0435\u0442 \u0444\u043e\u043d\u0430","text_none":"\u0411\u0435\u0437 \u0432\u0441\u0435\u0433\u043e","text_blink":"\u041c\u0435\u0440\u0446\u0430\u044e\u0449\u0438\u0439","text_case":"\u0420\u0435\u0433\u0438\u0441\u0442\u0440","text_striketrough":"\u0417\u0430\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439","text_underline":"\u041f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439","text_overline":"\u0421 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0435\u0440\u0442\u043e\u0439","text_decoration":"\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435","text_color":"\u0426\u0432\u0435\u0442",text:"\u0422\u0435\u043a\u0441\u0442",background:"\u0424\u043e\u043d",block:"\u0411\u043b\u043e\u043a",box:"\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440",border:"\u0413\u0440\u0430\u043d\u0438\u0446\u0430",list:"\u0421\u043f\u0438\u0441\u043e\u043a"});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.template_dlg',{title:"\u0428\u0430\u0431\u043b\u043e\u043d\u044b",label:"\u0428\u0430\u0431\u043b\u043e\u043d","desc_label":"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435",desc:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d",select:"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d",preview:"\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440",warning:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u043e\u0442\u0435\u0440\u044f\u043c \u0434\u0430\u043d\u043d\u044b\u0445/","mdate_format":"%Y.%m.%d %H:%M:%S","cdate_format":"%Y.%m.%d %H:%M:%S","months_long":"\u044f\u043d\u0432\u0430\u0440\u044c,\u0444\u0435\u0432\u0440\u0430\u043b\u044c,\u043c\u0430\u0440\u0442,\u0430\u043f\u0440\u0435\u043b\u044c,\u043c\u0430\u0439,\u0438\u044e\u043d\u044c,\u0438\u044e\u043b\u044c,\u0430\u0432\u0433\u0443\u0441\u0442,\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c,\u043e\u043a\u0442\u044f\u0431\u0440\u044c,\u043d\u043e\u044f\u0431\u0440\u044c,\u0434\u0435\u043a\u0430\u0431\u0440\u044c","months_short":"\u044f\u043d\u0432,\u0444\u0435\u0432,\u043c\u0430\u0440\u0442,\u0430\u043f\u0440,\u043c\u0430\u0439,\u0438\u044e\u043d\u044c,\u0438\u044e\u043b\u044c,\u0430\u0432\u0433,\u0441\u0435\u043d,\u043e\u043a\u0442,\u043d\u043e\u044f,\u0434\u0435\u043a","day_long":"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435,\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a,\u0432\u0442\u043e\u0440\u043d\u0438\u043a,\u0441\u0440\u0435\u0434\u0430,\u0447\u0435\u0442\u0432\u0435\u0440\u0433,\u043f\u044f\u0442\u043d\u0438\u0446\u0443,\u0441\u0443\u0431\u0431\u043e\u0442\u0430,\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435","day_short":"\u0432\u0441,\u043f\u043d,\u0432\u0442,\u0441\u0440,\u0447\u0442,\u043f\u0442,\u0441\u0431,\u0432\u0441"});

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.xhtmlxtras_dlg',{"attribs_title":"\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430","option_rtl":"\u0421\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e","option_ltr":"\u0421\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e","insert_date":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0434\u0430\u0442\u0443/\u0432\u0440\u0435\u043c\u044f",remove:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c","title_cite_element":"\u0426\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435","title_abbr_element":"\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435","title_acronym_element":"\u0410\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0446\u0438\u044f","title_del_element":"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435","title_ins_element":"\u0417\u0430\u043c\u0435\u043d\u0430","fieldset_events_tab":"\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430","fieldset_attrib_tab":"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430","fieldset_general_tab":"\u041e\u0431\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b","events_tab":"\u0421\u043e\u0431\u044b\u0442\u0438\u044f","attrib_tab":"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b","general_tab":"\u041e\u0431\u0449\u0435\u0435","attribute_attrib_tab":"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b","attribute_events_tab":"\u0421\u043e\u0431\u044b\u0442\u0438\u044f","attribute_label_accesskey":"\u041a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430","attribute_label_tabindex":"\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a","attribute_label_langcode":"\u042f\u0437\u044b\u043a","attribute_option_rtl":"\u0421\u043f\u0440\u0430\u0432\u0430 \u043d\u0430\u043b\u0435\u0432\u043e","attribute_option_ltr":"\u0421\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e","attribute_label_langdir":"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430","attribute_label_datetime":"\u0414\u0430\u0442\u0430/\u0412\u0440\u0435\u043c\u044f","attribute_label_cite":"\u0426\u0438\u0442\u0430\u0442\u0430","attribute_label_style":"\u0421\u0442\u0438\u043b\u044c","attribute_label_class":"\u041a\u043b\u0430\u0441\u0441","attribute_label_id":"\u0418\u043c\u044f","attribute_label_title":"\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
tinyMCE.addI18n('ru.simple',{"cleanup_desc":"\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0439 \u043a\u043e\u0434","redo_desc":"\u0412\u0435\u0440\u043d\u0443\u0442\u044c (Ctrl+Y)","undo_desc":"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c (Ctrl+Z)","numlist_desc":"\u041d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a","bullist_desc":"\u041c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a","striketrough_desc":"\u0417\u0430\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439","underline_desc":"\u041f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439 (Ctrl+U)","italic_desc":"\u041a\u0443\u0440\u0441\u0438\u0432 (Ctrl+I)","bold_desc":"\u041f\u043e\u043b\u0443\u0436\u0438\u0440\u043d\u044b\u0439 (Ctrl+B)"});

Binary file not shown.

View File

@ -0,0 +1,214 @@
# encoding: utf-8
require 'spec_helper'
describe ContentInstance do
before(:each) do
Site.any_instance.stubs(:create_default_pages!).returns(true)
@content_type = FactoryGirl.build(:content_type)
@content_type.content_custom_fields.build :label => 'Title', :kind => 'String'
@content_type.content_custom_fields.build :label => 'Description', :kind => 'Text'
@content_type.content_custom_fields.build :label => 'Visible ?', :kind => 'Text', :_alias => 'visible'
@content_type.highlighted_field_name = 'custom_field_1'
end
describe '#validation' do
it 'is valid' do
build_content.should be_valid
end
## Validations ##
it 'requires the presence of title' do
content = build_content :title => nil
content.should_not be_valid
content.errors[:title].should == ["can't be blank"]
end
it 'requires the presence of the permalink (_slug)' do
content = build_content :title => nil
content.should_not be_valid
content.errors[:_slug].should == ["can't be blank"]
end
end
context 'setting the slug' do
before :each do
build_content(:_slug => 'dogs').tap(&:save!)._slug.should == 'dogs'
end
it 'uses the given slug if it is unique' do
build_content(:_slug => 'monkeys').tap(&:save!)._slug.should == 'monkeys'
build_content(:_slug => 'cats-2').tap(&:save!)._slug.should == 'cats-2'
end
it 'appends a number to the end of the slug if it is not unique' do
build_content(:_slug => 'dogs').tap(&:save!)._slug.should == 'dogs-1'
build_content(:_slug => 'dogs').tap(&:save!)._slug.should == 'dogs-2'
build_content(:_slug => 'dogs-2').tap(&:save!)._slug.should == 'dogs-3'
build_content(:_slug => 'dogs-2').tap(&:save!)._slug.should == 'dogs-4'
end
it 'ignores the case of a slug' do
build_content(:_slug => 'dogs').tap(&:save!)._slug.should == 'dogs-1'
build_content(:_slug => 'DOGS').tap(&:save!)._slug.should == 'dogs-2'
end
it 'correctly handles slugs with multiple numbers' do
build_content(:_slug => 'fish-1-2').tap(&:save!)._slug.should == 'fish-1-2'
build_content(:_slug => 'fish-1-2').tap(&:save!)._slug.should == 'fish-1-3'
build_content(:_slug => 'fish-1-hi').tap(&:save!)._slug.should == 'fish-1-hi'
build_content(:_slug => 'fish-1-hi').tap(&:save!)._slug.should == 'fish-1-hi-1'
end
end
describe "#navigation" do
before(:each) do
%w(first second third).each_with_index do |item,index|
content = build_content({:title => item.to_s})
content._position_in_list = index
instance_variable_set "@#{item}", content
end
end
it 'should find previous item when available' do
@second.previous.custom_field_1.should == "first"
@second.previous._position_in_list.should == 0
end
it 'should find next item when available' do
@second.next.custom_field_1.should == "third"
@second.next._position_in_list.should == 2
end
it 'should return nil when fetching previous item on first in list' do
@first.previous.should == nil
end
it 'should return nil when fetching next item on last in list' do
@third.next.should == nil
end
end
describe '#permalink' do
before(:each) do
@content = build_content
end
it 'has a default value based on the highlighted field' do
@content.send(:set_slug)
@content._permalink.should == 'locomotive'
end
it 'is empty if no value for the highlighted field is provided' do
@content.title = nil; @content.send(:set_slug)
@content._permalink.should be_nil
end
it 'includes dashes instead of white spaces' do
@content.title = 'my content instance'; @content.send(:set_slug)
@content._permalink.should == 'my-content-instance'
end
it 'removes accentued characters' do
@content.title = "une chèvre dans le pré"; @content.send(:set_slug)
@content._permalink.should == 'une-chevre-dans-le-pre'
end
it 'removes dots' do
@content.title = "my.test"; @content.send(:set_slug)
@content._permalink.should == 'my-test'
end
end
describe '#visibility' do
before(:each) do
@content = build_content
end
it 'is visible by default' do
@content._visible?.should be_true
@content.visible?.should be_true
end
it 'can be visible even if it is nil' do
@content.visible = nil
@content.send(:set_visibility).should be_true
@content.visible?.should be_true
end
it 'can not be visible' do
@content.visible = false
@content.send(:set_visibility).should be_true
@content.visible?.should be_false
end
end
describe '#requirements' do
it 'has public access to the highlighted field value' do
build_content.highlighted_field_value.should == 'Locomotive'
end
end
describe '#api' do
before(:each) do
@account_1 = FactoryGirl.build('admin user', :id => fake_bson_id('1'))
@account_2 = FactoryGirl.build('frenchy user', :id => fake_bson_id('2'))
@content_type.api_enabled = true
@content_type.api_accounts = ['', @account_1.id, @account_2.id]
Site.any_instance.stubs(:accounts).returns([@account_1, @account_2])
@content = build_content
end
it 'does not send email notifications if the api is disabled' do
@content_type.api_enabled = false
Admin::Notifications.expects(:new_content_instance).never
@content.save
end
it 'does not send email notifications if no api accounts' do
@content_type.api_accounts = nil
Admin::Notifications.expects(:new_content_instance).never
@content.save
end
it 'sends email notifications when a new instance is created' do
Admin::Notifications.expects(:new_content_instance).with(@account_1, @content).returns(mock('mailer', :deliver => true))
Admin::Notifications.expects(:new_content_instance).with(@account_2, @content).returns(mock('mailer', :deliver => true))
@content.save
end
end
describe '#site' do
it 'delegates to the content type' do
@content_type.expects(:site)
build_content.site
end
end
after(:all) do
ENV['APP_TLD'] = nil
Locomotive.configure_for_test(true)
end
def build_content(options = {})
@content_type.contents.build({ :title => 'Locomotive', :description => 'Lorem ipsum....' }.merge(options))
end
def fake_bson_id(id)
BSON::ObjectId(id.to_s.rjust(24, '0'))
end
end