refinerycms-core 0.9.9.3 → 0.9.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,11 +17,10 @@
17
17
  'jquery/jquery.jcarousel.js',
18
18
  :cache => ("cache/jquery-plugins" if js_caching) unless login -%>
19
19
 
20
- <%= yield :after_javascript_libraries -%>
20
+ <%= javascript_include_tag 'wymeditor/jquery.refinery.wymeditor.js', 'admin' %>
21
21
 
22
- <%= javascript_include_tag 'wymeditor/jquery.refinery.wymeditor.js',
23
- 'admin',
24
- 'refinery/boot_wym',
22
+ <%= yield :after_javascript_libraries -%>
23
+ <%= javascript_include_tag 'refinery/boot_wym',
25
24
  'refinery/core',
26
25
  'refinery/site_bar',
27
26
  'refinery/admin',
@@ -30,3 +29,4 @@
30
29
  <%= javascript_include_tag 'refinery/core' if login -%>
31
30
 
32
31
  <%= yield :javascripts -%>
32
+
@@ -8,7 +8,7 @@
8
8
  logger.warn "This change is necessary so that we can deliver a performant experience for the user."
9
9
  logger.warn "Called from: #{caller.detect{|c| c =~ %r{#{Rails.root.to_s}}}.inspect.to_s.split(':in').first}\n\n"
10
10
  end
11
- if (yielded_head_libraries = yield(:head)).present?
11
+ if (yielded_head_libraries = yield(:head_libraries)).present?
12
12
  logger.warn "\n-- DEPRECATION WARNING --"
13
13
  logger.warn "The use of 'content_for :head_libraries' is DEPRECATED for the frontend layouts."
14
14
  logger.warn "Please use content_for :before_javascript_libraries or content_for :after_javascript_libraries instead."
@@ -1,12 +1,12 @@
1
1
  <%
2
- insert_text = "<span id='no_resource_selected' class='nothing_selected' #{"style='display: none;'" if resource.present?}>
2
+ insert_text = "<span id='no_resource_selected_#{field}' class='nothing_selected' #{"style='display: none;'" if resource.present?}>
3
3
  #{t('.no_resource_selected')}
4
4
  </span>".html_safe
5
5
  insert_link = insert_admin_resources_url({
6
6
  :dialog => true,
7
- :update_resource => 'current_resource',
8
- :update_text => 'current_resource_text',
9
- :callback => 'resource_changed',
7
+ :update_resource => "current_resource_#{field}",
8
+ :update_text => "current_resource_text_#{field}",
9
+ :callback => "resource_changed_#{field}",
10
10
  :field => [f.object_name, field].join('_'),
11
11
  :current_link => "#{resource.url if resource.present?}",
12
12
  :height => 480
@@ -16,11 +16,11 @@
16
16
  <div>
17
17
  <%= link_to insert_text, insert_link,
18
18
  :name => t('.name'),
19
- :id => "current_resource_link"
19
+ :id => "current_resource_link_#{field}"
20
20
  %>
21
- <div id='current_resource_container' <%= "style='display:none'" unless resource.present? %>>
21
+ <div id='current_resource_container_<%= field %>' <%= "style='display:none'" unless resource.present? %>>
22
22
  <span id='current_resource_tag'><%= t('.current') %>:</span>
23
- <span id='current_resource_text'>
23
+ <span id='current_resource_text_<%= field %>'>
24
24
  <%= "#{resource.title} (#{resource.file_name})" if resource.present? %>
25
25
  </span>
26
26
  <br/>
@@ -28,39 +28,40 @@
28
28
  #{t('.download_current')}
29
29
  (<em>#{t('.opens_in_new_window')}</em>)".html_safe,
30
30
  "#{resource.url if resource.present?}",
31
- :id => "current_resource",
31
+ :id => "current_resource_#{field}",
32
32
  :target => "_blank" %>
33
33
  </div>
34
34
  <br/>
35
35
  <%= link_to t('.remove_current'), "",
36
- :id => "remove_resource",
37
- :style => "#{"display:none;" unless resource.present?}" %>
36
+ :id => "remove_resource_#{field}",
37
+ :style => "#{"display:none;" unless resource.present?}" %>
38
38
  </div>
39
39
 
40
40
  <% content_for :javascripts do %>
41
41
  <script>
42
- resource_changed = function(callback_args) {
43
- $('#remove_resource').show();
44
- $('#current_resource_container').show();
45
- $('#no_resource_selected').hide();
42
+ resource_changed_<%= field %> = function(callback_args) {
43
+ $('#remove_resource_<%= field %>').show();
44
+ $('#current_resource_container_<%= field %>').show();
45
+ $('#no_resource_selected_<%= field %>').hide();
46
46
  $('iframe#dialog_iframe').dialog("close");
47
47
  $('iframe#dialog_iframe').remove().parents(".ui-dialog").remove();
48
48
  $('#<%= f.object_name %>_<%= field %>').val(callback_args.id);
49
- $('#current_resource_link').attr('href', $('#current_resource_link').attr('href').replace(/current_link=([^&])*&/, "current_link=" + callback_args.href + "&"));
50
- $("#current_resource").attr('href', callback_args.href);
51
- $('#current_resource_text').html(callback_args.html);
49
+ $('#current_resource_link_<%= field %>').attr('href', $('#current_resource_link_<%= field %>').attr('href').replace(/current_link=([^&])*&/, "current_link=" + callback_args.href + "&"));
50
+ $("#current_resource_<%= field %>").attr('href', callback_args.href);
51
+ $('#current_resource_text_<%= field %>').html(callback_args.html);
52
52
  }
53
53
 
54
54
  $(document).ready(function(e) {
55
- $('#remove_resource').click(function(e) {
55
+ $('#remove_resource_<%= field %>').click(function(e) {
56
56
  $('#<%= f.object_name %>_<%= field %>').val("");
57
- $('#current_resource_container').hide();
58
- $('#current_resource_text').html('');
59
- $('#no_resource_selected').show();
60
- $('#current_resource_link').attr('href', $('#current_resource_link').attr('href').replace(/current_link=([^&])*&/, "current_link=&"));
57
+ $('#current_resource_container_<%= field %>').hide();
58
+ $('#current_resource_text_<%= field %>').html('');
59
+ $('#no_resource_selected_<%= field %>').show();
60
+ $('#current_resource_link_<%= field %>').attr('href', $('#current_resource_link_<%= field %>').attr('href').replace(/current_link=([^&])*&/, "current_link=&"));
61
61
  $(this).hide();
62
62
  e.preventDefault();
63
63
  });
64
64
  });
65
65
  </script>
66
66
  <% end %>
67
+
@@ -21,9 +21,9 @@ cs:
21
21
  cancel: Storno
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} byl úspěšně vytvořen.
25
- updated: %{what} byl úspěšně aktualizován.
26
- destroyed: %{what} byl úspěšně smazán.
24
+ created: '%{what} byl úspěšně vytvořen.'
25
+ updated: '%{what} byl úspěšně aktualizován.'
26
+ destroyed: '%{what} byl úspěšně smazán.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Odhlásit
@@ -21,9 +21,9 @@ da:
21
21
  cancel: Annullér
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} er oprettet.
25
- updated: %{what} er opdateret.
26
- destroyed: %{what} er slettet.
24
+ created: '%{what} er oprettet.'
25
+ updated: '%{what} er opdateret.'
26
+ destroyed: '%{what} er slettet.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Log af
@@ -21,9 +21,9 @@ de:
21
21
  cancel: Abbrechen
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} wurde erfolgreich angelegt.
25
- updated: %{what} wurde erfolgreich aktualisiert.
26
- destroyed: %{what} wurde erfolgreich gelöscht.
24
+ created: '%{what} wurde erfolgreich angelegt.'
25
+ updated: '%{what} wurde erfolgreich aktualisiert.'
26
+ destroyed: '%{what} wurde erfolgreich gelöscht.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Abmelden
@@ -21,9 +21,9 @@ el:
21
21
  cancel: Ακύρωση
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} προστέθηκε επιτυχώς.
25
- updated: %{what} επεξεργάστηκε επιτυχώς.
26
- destroyed: %{what} αφαιρέθηκε επιτυχώς.
24
+ created: '%{what} προστέθηκε επιτυχώς.'
25
+ updated: '%{what} επεξεργάστηκε επιτυχώς.'
26
+ destroyed: '%{what} αφαιρέθηκε επιτυχώς.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Αποσύνδεση
@@ -21,9 +21,9 @@ en:
21
21
  cancel: Cancel
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} was successfully added.
25
- updated: %{what} was successfully updated.
26
- destroyed: %{what} was successfully removed.
24
+ created: '%{what} was successfully added.'
25
+ updated: '%{what} was successfully updated.'
26
+ destroyed: '%{what} was successfully removed.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Log out
@@ -14,9 +14,9 @@ es:
14
14
  cancel: Cancelar
15
15
  refinery:
16
16
  crudify:
17
- created: %{what} fue creado correctamente.
18
- updated: %{what} fue actualizado correctamente.
19
- destroyed: %{what} fue borrado correctamente.
17
+ created: '%{what} fue creado correctamente.'
18
+ updated: '%{what} fue actualizado correctamente.'
19
+ destroyed: '%{what} fue borrado correctamente.'
20
20
  shared:
21
21
  site_bar:
22
22
  log_out: Salir
@@ -21,9 +21,9 @@ fr:
21
21
  cancel: Annuler
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} a été correctement créé.
25
- updated: %{what} a été correctement mis à jour.
26
- destroyed: %{what} a été correctement supprimé.
24
+ created: '%{what} a été correctement créé.'
25
+ updated: '%{what} a été correctement mis à jour.'
26
+ destroyed: '%{what} a été correctement supprimé.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Me déconnecter
@@ -21,9 +21,9 @@ lolcat:
21
21
  cancel: CANCEL
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} WUZ SUCCESFULLY ADDD.
25
- updated: %{what} WUZ SUCCESFULLY UPDATD.
26
- destroyed: %{what} WUZ SUCCESFULLY REMOVD.
24
+ created: '%{what} WUZ SUCCESFULLY ADDD.'
25
+ updated: '%{what} WUZ SUCCESFULLY UPDATD.'
26
+ destroyed: '%{what} WUZ SUCCESFULLY REMOVD.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: LOG OUT
@@ -21,9 +21,9 @@ lt:
21
21
  cancel: Atšaukti
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} buvo sėkmingai pridėtas.
25
- updated: %{what} buvo sėkmingai atnaujintas.
26
- destroyed: %{what} buvo sėkmingai pašalintas.
24
+ created: '%{what} buvo sėkmingai pridėtas.'
25
+ updated: '%{what} buvo sėkmingai atnaujintas.'
26
+ destroyed: '%{what} buvo sėkmingai pašalintas.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Atsijungti
@@ -21,9 +21,9 @@ lv:
21
21
  cancel: Atcelt
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} tika veiksmīgi izveidots.
25
- updated: %{what} tika veiksmīgi atjaunots.
26
- destroyed: %{what} tika veiksmīgi izdzēsts.
24
+ created: '%{what} tika veiksmīgi izveidots.'
25
+ updated: '%{what} tika veiksmīgi atjaunots.'
26
+ destroyed: '%{what} tika veiksmīgi izdzēsts.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Iziet
@@ -21,9 +21,9 @@ rs:
21
21
  cancel: Poništi
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} je uspešno dodat(a).
25
- updated: %{what} je uspešno izmenjen(a).
26
- destroyed: %{what} je uspešno uklonjen(a).
24
+ created: '%{what} je uspešno dodat(a).'
25
+ updated: '%{what} je uspešno izmenjen(a).'
26
+ destroyed: '%{what} je uspešno uklonjen(a).'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Log out
@@ -21,9 +21,9 @@ sv:
21
21
  cancel: Avbryt
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} lades till.
25
- updated: %{what} uppdaterades.
26
- destroyed: %{what} togs bort.
24
+ created: '%{what} lades till.'
25
+ updated: '%{what} uppdaterades.'
26
+ destroyed: '%{what} togs bort.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Logga ut
@@ -21,9 +21,9 @@ vi:
21
21
  cancel: Bỏ qua
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} vừa được thêm vào.
25
- updated: %{what} vừa được cập nhật.
26
- destroyed: %{what} vừa được xóa bỏ.
24
+ created: '%{what} vừa được thêm vào.'
25
+ updated: '%{what} vừa được cập nhật.'
26
+ destroyed: '%{what} vừa được xóa bỏ.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: Đăng xuất
@@ -21,9 +21,9 @@ zh-CN:
21
21
  cancel: 取消
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} 添加成功.
25
- updated: %{what} 编辑成功.
26
- destroyed: %{what} 删除成功.
24
+ created: '%{what} 添加成功.'
25
+ updated: '%{what} 编辑成功.'
26
+ destroyed: '%{what} 删除成功.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: 注销
@@ -21,9 +21,9 @@ zh-TW:
21
21
  cancel: 取消
22
22
  refinery:
23
23
  crudify:
24
- created: %{what} 成功地加入.
25
- updated: %{what} 成功地更新.
26
- destroyed: %{what} 成功地移除.
24
+ created: '%{what} 成功地加入.'
25
+ updated: '%{what} 成功地更新.'
26
+ destroyed: '%{what} 成功地移除.'
27
27
  shared:
28
28
  site_bar:
29
29
  log_out: 登出
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2005-2010 [Resolve Digital](http://www.resolvedigital.com)
3
+ Copyright (c) 2005-2011 [Resolve Digital](http://www.resolvedigital.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,30 +1,2 @@
1
- /*
2
- * Modernizr v1.6
3
- * http://www.modernizr.com
4
- *
5
- * Developed by:
6
- * - Faruk Ates http://farukat.es/
7
- * - Paul Irish http://paulirish.com/
8
- *
9
- * Copyright (c) 2009-2010
10
- * Dual-licensed under the BSD or MIT licenses.
11
- * http://www.modernizr.com/license/
12
- */
13
- window.Modernizr=function(i,e,u){function s(a,b){return(""+a).indexOf(b)!==-1}function D(a,b){for(var c in a)if(j[a[c]]!==u&&(!b||b(a[c],E)))return true}function n(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);c=(a+" "+F.join(c+" ")+c).split(" ");return!!D(c,b)}function S(){f.input=function(a){for(var b=0,c=a.length;b<c;b++)L[a[b]]=!!(a[b]in h);return L}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));f.inputtypes=function(a){for(var b=0,c,k=a.length;b<
14
- k;b++){h.setAttribute("type",a[b]);if(c=h.type!=="text"){h.value=M;if(/^range$/.test(h.type)&&h.style.WebkitAppearance!==u){l.appendChild(h);c=e.defaultView;c=c.getComputedStyle&&c.getComputedStyle(h,null).WebkitAppearance!=="textfield"&&h.offsetHeight!==0;l.removeChild(h)}else/^(search|tel)$/.test(h.type)||(c=/^(url|email)$/.test(h.type)?h.checkValidity&&h.checkValidity()===false:h.value!=M)}N[a[b]]=!!c}return N}("search tel url email datetime date month week time datetime-local number range color".split(" "))}
15
- var f={},l=e.documentElement,E=e.createElement("modernizr"),j=E.style,h=e.createElement("input"),M=":)",O=Object.prototype.toString,q=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),F="Webkit Moz O ms Khtml".split(" "),v={svg:"http://www.w3.org/2000/svg"},d={},N={},L={},P=[],w,Q=function(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent=a+"{#modernizr{height:3px}}";(e.head||e.getElementsByTagName("head")[0]).appendChild(b);c.id="modernizr";l.appendChild(c);a=c.offsetHeight===
16
- 3;b.parentNode.removeChild(b);c.parentNode.removeChild(c);return!!a},o=function(){var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return function(b,c){c=c||document.createElement(a[b]||"div");b="on"+b;var k=b in c;if(!k){c.setAttribute||(c=document.createElement("div"));if(c.setAttribute&&c.removeAttribute){c.setAttribute(b,"");k=typeof c[b]=="function";if(typeof c[b]!="undefined")c[b]=u;c.removeAttribute(b)}}return k}}(),G={}.hasOwnProperty,R;R=
17
- typeof G!=="undefined"&&typeof G.call!=="undefined"?function(a,b){return G.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};d.flexbox=function(){var a=e.createElement("div"),b=e.createElement("div");(function(k,g,r,x){g+=":";k.style.cssText=(g+q.join(r+";"+g)).slice(0,-g.length)+(x||"")})(a,"display","box","width:42px;padding:0;");b.style.cssText=q.join("box-flex:1;")+"width:10px;";a.appendChild(b);l.appendChild(a);var c=b.offsetWidth===42;a.removeChild(b);
18
- l.removeChild(a);return c};d.canvas=function(){var a=e.createElement("canvas");return!!(a.getContext&&a.getContext("2d"))};d.canvastext=function(){return!!(f.canvas&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.webgl=function(){var a=e.createElement("canvas");try{if(a.getContext("webgl"))return true}catch(b){}try{if(a.getContext("experimental-webgl"))return true}catch(c){}return false};d.touch=function(){return"ontouchstart"in i||Q("@media ("+q.join("touch-enabled),(")+
19
- "modernizr)")};d.geolocation=function(){return!!navigator.geolocation};d.postmessage=function(){return!!i.postMessage};d.websqldatabase=function(){return!!i.openDatabase};d.indexedDB=function(){for(var a=-1,b=F.length;++a<b;){var c=F[a].toLowerCase();if(i[c+"_indexedDB"]||i[c+"IndexedDB"])return true}return false};d.hashchange=function(){return o("hashchange",i)&&(document.documentMode===u||document.documentMode>7)};d.history=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return o("drag")&&
20
- o("dragstart")&&o("dragenter")&&o("dragover")&&o("dragleave")&&o("dragend")&&o("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){j.cssText="background-color:rgba(150,255,150,.5)";return s(j.backgroundColor,"rgba")};d.hsla=function(){j.cssText="background-color:hsla(120,40%,100%,.5)";return s(j.backgroundColor,"rgba")||s(j.backgroundColor,"hsla")};d.multiplebgs=function(){j.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(j.background)};d.backgroundsize=
21
- function(){return n("backgroundSize")};d.borderimage=function(){return n("borderImage")};d.borderradius=function(){return n("borderRadius","",function(a){return s(a,"orderRadius")})};d.boxshadow=function(){return n("boxShadow")};d.textshadow=function(){return e.createElement("div").style.textShadow===""};d.opacity=function(){var a=q.join("opacity:.5;")+"";j.cssText=a;return s(j.opacity,"0.5")};d.cssanimations=function(){return n("animationName")};d.csscolumns=function(){return n("columnCount")};d.cssgradients=
22
- function(){var a=("background-image:"+q.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+q.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);j.cssText=a;return s(j.backgroundImage,"gradient")};d.cssreflections=function(){return n("boxReflect")};d.csstransforms=function(){return!!D(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!D(["perspectiveProperty","WebkitPerspective",
23
- "MozPerspective","OPerspective","msPerspective"]);if(a)a=Q("@media ("+q.join("transform-3d),(")+"modernizr)");return a};d.csstransitions=function(){return n("transitionProperty")};d.fontface=function(){var a,b=e.head||e.getElementsByTagName("head")[0]||l,c=e.createElement("style"),k=e.implementation||{hasFeature:function(){return false}};c.type="text/css";b.insertBefore(c,b.firstChild);a=c.sheet||c.styleSheet;b=k.hasFeature("CSS2","")?function(g){if(!(a&&g))return false;var r=false;try{a.insertRule(g,
24
- 0);r=!/unknown/i.test(a.cssRules[0].cssText);a.deleteRule(a.cssRules.length-1)}catch(x){}return r}:function(g){if(!(a&&g))return false;a.cssText=g;return a.cssText.length!==0&&!/unknown/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(g.split(" ")[0])===0};f._fontfaceready=function(g){g(f.fontface)};return b('@font-face { font-family: "font"; src: "font.ttf"; }')};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');
25
- b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"')||a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localstorage=function(){try{return"localStorage"in
26
- i&&i.localStorage!==null}catch(a){return false}};d.sessionstorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webWorkers=function(){return!!i.Worker};d.applicationcache=function(){return!!i.applicationCache};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS(v.svg,"svg").createSVGRect};d.inlinesvg=function(){var a=document.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==v.svg};d.smil=function(){return!!e.createElementNS&&
27
- /SVG/.test(O.call(e.createElementNS(v.svg,"animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(O.call(e.createElementNS(v.svg,"clipPath")))};for(var H in d)if(R(d,H)){w=H.toLowerCase();f[w]=d[H]();P.push((f[w]?"":"no-")+w)}f.input||S();f.crosswindowmessaging=f.postmessage;f.historymanagement=f.history;f.addTest=function(a,b){a=a.toLowerCase();if(!f[a]){b=!!b();l.className+=" "+(b?"":"no-")+a;f[a]=b;return f}};j.cssText="";E=h=null;i.attachEvent&&function(){var a=e.createElement("div");
28
- a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function c(p){for(var m=-1;++m<r;)p.createElement(g[m])}function k(p,m){for(var I=p.length,t=-1,y,J=[];++t<I;){y=p[t];m=y.media||m;J.push(k(y.imports,m));J.push(y.cssText)}return J.join("")}var g="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),r=g.length,x=RegExp("<(/*)(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)",
29
- "gi"),T=RegExp("\\b(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)\\b(?!.*[;}])","gi"),z=b.createDocumentFragment(),A=b.documentElement,K=A.firstChild,B=b.createElement("style"),C=b.createElement("body");B.media="all";c(b);c(z);a.attachEvent("onbeforeprint",function(){for(var p=-1;++p<r;)for(var m=b.getElementsByTagName(g[p]),I=m.length,t=-1;++t<I;)if(m[t].className.indexOf("iepp_")<0)m[t].className+=" iepp_"+
30
- g[p];K.insertBefore(B,K.firstChild);B.styleSheet.cssText=k(b.styleSheets,"all").replace(T,".iepp_$1");z.appendChild(b.body);A.appendChild(C);C.innerHTML=z.firstChild.innerHTML.replace(x,"<$1bdo")});a.attachEvent("onafterprint",function(){C.innerHTML="";A.removeChild(C);K.removeChild(B);A.appendChild(z.firstChild)})}(this,document);f._enableHTML5=true;f._version="1.6";l.className=l.className.replace(/\bno-js\b/,"")+" js";l.className+=" "+P.join(" ");return f}(this,this.document);
1
+ // Modernizr v1.7 www.modernizr.com
2
+ window.Modernizr=function(a,b,c){function G(){e.input=function(a){for(var b=0,c=a.length;b<c;b++)t[a[b]]=!!(a[b]in l);return t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)l.setAttribute("type",f=a[d]),e=l.type!=="text",e&&(l.value=m,l.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&l.style.WebkitAppearance!==c?(g.appendChild(l),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(l,null).WebkitAppearance!=="textfield"&&l.offsetHeight!==0,g.removeChild(l)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=l.checkValidity&&l.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(l),g.offsetWidth,e=l.value!=m,g.removeChild(l)):e=l.value!=m)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}function F(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return!!E(d,b)}function E(a,b){for(var d in a)if(k[a[d]]!==c&&(!b||b(a[d],j)))return!0}function D(a,b){return(""+a).indexOf(b)!==-1}function C(a,b){return typeof a===b}function B(a,b){return A(o.join(a+";")+(b||""))}function A(a){k.cssText=a}var d="1.7",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l=b.createElement("input"),m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v,w=function(a){var c=b.createElement("style"),d=b.createElement("div"),e;c.textContent=a+"{#modernizr{height:3px}}",h.appendChild(c),d.id="modernizr",g.appendChild(d),e=d.offsetHeight===3,c.parentNode.removeChild(c),d.parentNode.removeChild(d);return!!e},x=function(){function d(d,e){e=e||b.createElement(a[d]||"div");var f=(d="on"+d)in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),y=({}).hasOwnProperty,z;C(y,c)||C(y.call,c)?z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)}:z=function(a,b){return y.call(a,b)},r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return a.getContext&&a.getContext("2d")},r.canvastext=function(){return e.canvas&&C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return"ontouchstart"in a||w("@media ("+o.join("touch-enabled),(")+"modernizr)")},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b<c;){var d=p[b].toLowerCase();if(a[d+"_indexedDB"]||a[d+"IndexedDB"])return!0}return!1},r.hashchange=function(){return x("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return !!(a.history&&history.pushState)},r.draganddrop=function(){return x("dragstart")&&x("drop")},r.websockets=function(){return"WebSocket"in a},r.rgba=function(){A("background-color:rgba(150,255,150,.5)");return D(k.backgroundColor,"rgba")},r.hsla=function(){A("background-color:hsla(120,40%,100%,.5)");return D(k.backgroundColor,"rgba")||D(k.backgroundColor,"hsla")},r.multiplebgs=function(){A("background:url(//:),url(//:),red url(//:)");return(new RegExp("(url\\s*\\(.*?){3}")).test(k.background)},r.backgroundsize=function(){return F("backgroundSize")},r.borderimage=function(){return F("borderImage")},r.borderradius=function(){return F("borderRadius","",function(a){return D(a,"orderRadius")})},r.boxshadow=function(){return F("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){B("opacity:.55");return/^0.55$/.test(k.opacity)},r.cssanimations=function(){return F("animationName")},r.csscolumns=function(){return F("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";A((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return D(k.backgroundImage,"gradient")},r.cssreflections=function(){return F("boxReflect")},r.csstransforms=function(){return!!E(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},r.csstransforms3d=function(){var a=!!E(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=w("@media ("+o.join("transform-3d),(")+"modernizr)"));return a},r.csstransitions=function(){return F("transitionProperty")},r.fontface=function(){var a,c,d=h||g,e=b.createElement("style"),f=b.implementation||{hasFeature:function(){return!1}};e.type="text/css",d.insertBefore(e,d.firstChild),a=e.sheet||e.styleSheet;var i=f.hasFeature("CSS2","")?function(b){if(!a||!b)return!1;var c=!1;try{a.insertRule(b,0),c=/src/i.test(a.cssRules[0].cssText),a.deleteRule(a.cssRules.length-1)}catch(d){}return c}:function(b){if(!a||!b)return!1;a.cssText=b;return a.cssText.length!==0&&/src/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(b.split(" ")[0])===0};c=i('@font-face { font-family: "font"; src: url(data:,); }'),d.removeChild(e);return c},r.video=function(){var a=b.createElement("video"),c=!!a.canPlayType;if(c){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return c},r.audio=function(){var a=b.createElement("audio"),c=!!a.canPlayType;c&&(c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;"));return c},r.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},r.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},r.webWorkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var H in r)z(r,H)&&(v=H.toLowerCase(),e[v]=r[H](),u.push((e[v]?"":"no-")+v));e.input||G(),e.crosswindowmessaging=e.postmessage,e.historymanagement=e.history,e.addTest=function(a,b){a=a.toLowerCase();if(!e[a]){b=!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b;return e}},A(""),j=l=null,f&&a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function p(a,b){var c=-1,d=a.length,e,f=[];while(++c<d)e=a[c],(b=e.media||b)!="screen"&&f.push(p(e.imports,b),e.cssText);return f.join("")}function o(a){var b=-1;while(++b<e)a.createElement(d[b])}var c="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",d=c.split("|"),e=d.length,f=new RegExp("(^|\\s)("+c+")","gi"),g=new RegExp("<(/*)("+c+")","gi"),h=new RegExp("(^|[^\\n]*?\\s)("+c+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),i=b.createDocumentFragment(),j=b.documentElement,k=j.firstChild,l=b.createElement("body"),m=b.createElement("style"),n;o(b),o(i),k.insertBefore(m,k.firstChild),m.media="print",a.attachEvent("onbeforeprint",function(){var a=-1,c=p(b.styleSheets,"all"),k=[],o;n=n||b.body;while((o=h.exec(c))!=null)k.push((o[1]+o[2]+o[3]).replace(f,"$1.iepp_$2")+o[4]);m.styleSheet.cssText=k.join("\n");while(++a<e){var q=b.getElementsByTagName(d[a]),r=q.length,s=-1;while(++s<r)q[s].className.indexOf("iepp_")<0&&(q[s].className+=" iepp_"+d[a])}i.appendChild(n),j.appendChild(l),l.className=n.className,l.innerHTML=n.innerHTML.replace(g,"<$1font")}),a.attachEvent("onafterprint",function(){l.innerHTML="",j.removeChild(l),j.appendChild(n),m.styleSheet.cssText=""})}(a,b),e._enableHTML5=f,e._version=d,g.className=g.className.replace(/\bno-js\b/,"")+" js "+u.join(" ");return e}(this,this.document)
@@ -676,27 +676,26 @@ var page_options = {
676
676
  var tab_title = part_title.toLowerCase().replace(" ", "_");
677
677
 
678
678
  if ($('#part_' + tab_title).size() === 0) {
679
- $.get(page_options.new_part_url,
680
- {
679
+ $.get(page_options.new_part_url, {
681
680
  title: part_title
682
681
  , part_index: $('#new_page_part_index').val()
683
682
  , body: ''
684
- }
685
- , function(data, status){
683
+ }, function(data, status){
686
684
  $('#submit_continue_button').remove();
687
685
  // Add a new tab for the new content section.
688
686
  $(data).appendTo('#page_part_editors');
689
687
  page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title);
690
688
  page_options.tabs.tabs('select', $('#new_page_part_index').val());
691
689
 
692
- // turn the new textarea into a wymeditor.
693
- $('#page_parts_attributes_' + $('#new_page_part_index').val() + "_body").wymeditor(wymeditor_boot_options);
694
-
695
690
  // hook into wymedtior to instruct it to select this new tab again once it has loaded.
696
691
  WYMeditor.onload_functions.push(function() {
692
+ $('#page_part_new_' + $('#new_page_part_index').val()).appendTo('#page_part_editors');
697
693
  page_options.tabs.tabs('select', $('#new_page_part_index').val());
698
694
  });
699
695
 
696
+ // turn the new textarea into a wymeditor.
697
+ WYMeditor.init();
698
+
700
699
  // Wipe the title and increment the index counter by one.
701
700
  $('#new_page_part_index').val(parseInt($('#new_page_part_index').val(), 10) + 1);
702
701
  $('#new_page_part_title').val('');
@@ -704,6 +703,7 @@ var page_options = {
704
703
  page_options.tabs.find('> ul li a').corner('top 5px');
705
704
 
706
705
  $('#new_page_part_dialog').dialog('close');
706
+ $('#new_page_part_dialog').remove();
707
707
  }
708
708
  );
709
709
  }else{
@@ -40,7 +40,7 @@ $(document).ready(function(){
40
40
 
41
41
  $('.success_icon, .failure_icon').bind('click', function(e) {
42
42
  $.get($(this).attr('href'), $.proxy(function(data){
43
- $(this).css('background-image', null)
43
+ $(this).css('background-image', '')
44
44
  .removeClass('failure_icon').removeClass('success_icon')
45
45
  .addClass(data.enabled ? 'success_icon' : 'failure_icon');
46
46
  }, $(this)));
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-core}
5
- s.version = %q{0.9.9.3}
5
+ s.version = %q{0.9.9.4}
6
6
  s.summary = %q{Core engine for Refinery CMS}
7
7
  s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most engines}
8
- s.date = %q{2011-02-17}
8
+ s.date = %q{2011-02-24}
9
9
  s.email = %q{info@refinerycms.com}
10
10
  s.homepage = %q{http://refinerycms.com}
11
11
  s.rubyforge_project = %q{refinerycms}
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.require_paths = %w(lib)
15
15
  s.executables = %w()
16
16
 
17
- s.add_dependency 'refinerycms-base', '~> 0.9.9.3'
18
- s.add_dependency 'refinerycms-settings', '~> 0.9.9.3'
17
+ s.add_dependency 'refinerycms-base', '~> 0.9.9.4'
18
+ s.add_dependency 'refinerycms-settings', '~> 0.9.9.4'
19
19
  s.add_dependency 'refinerycms-generators', '~> 0.9.9.3'
20
20
  s.add_dependency 'acts_as_indexed', '~> 0.7'
21
21
  s.add_dependency 'friendly_id_globalize3', '~> 3.2.0'
@@ -102,10 +102,8 @@ Gem::Specification.new do |s|
102
102
  'config/locales/zh-CN.yml',
103
103
  'config/locales/zh-TW.yml',
104
104
  'config/routes.rb',
105
- 'crud.md',
106
105
  'doc',
107
106
  'doc/included-jquery-ui-packages.jpg',
108
- 'engines.md',
109
107
  'features',
110
108
  'features/search.feature',
111
109
  'features/site_bar.feature',
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.3
5
+ version: 0.9.9.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-02-17 00:00:00 +13:00
16
+ date: 2011-02-24 00:00:00 +13:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 0.9.9.3
27
+ version: 0.9.9.4
28
28
  type: :runtime
29
29
  version_requirements: *id001
30
30
  - !ruby/object:Gem::Dependency
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 0.9.9.3
38
+ version: 0.9.9.4
39
39
  type: :runtime
40
40
  version_requirements: *id002
41
41
  - !ruby/object:Gem::Dependency
@@ -208,9 +208,7 @@ files:
208
208
  - config/locales/zh-CN.yml
209
209
  - config/locales/zh-TW.yml
210
210
  - config/routes.rb
211
- - crud.md
212
211
  - doc/included-jquery-ui-packages.jpg
213
- - engines.md
214
212
  - features/search.feature
215
213
  - features/site_bar.feature
216
214
  - features/step_definitions/core_steps.rb
data/crud.md DELETED
@@ -1,197 +0,0 @@
1
- # The Magical Mixin: Crudify (create, read, update & delete)
2
-
3
- ## Introduction
4
-
5
- __Most controllers Refinery and other apps do four common things, create, read, update and delete stuff.__ Instead of writing the same logic for these actions over and over again we wrap all this functionality up into what we called ``crudify``.
6
-
7
- ``crudify`` takes these four basic actions and extends them to allow easy paging, searching and sorting too.
8
-
9
- Although this single file is included in Refinery, you could take just this single file and use it in any app you like.
10
-
11
- The best part about ``crudify`` is that this gives you a smart default and if there is anything you want to work differently just override that method.
12
-
13
- ## Where is it located?
14
-
15
- ``core/lib/refinery/crud.rb``
16
-
17
- ## How do I use it in my engines?
18
-
19
- All you need to do is call ``crudify`` in your controller.
20
-
21
- If you used the Refinery generator you're plugin will already be using ``crudify``.
22
-
23
- ### Example
24
-
25
- class NewsItemsController < ApplicationController
26
-
27
- crudify :news_item, :order => "created_at DESC"
28
-
29
- end
30
-
31
- ### Complex Example
32
-
33
- class NewsItemsController < ApplicationController
34
-
35
- crudify :news_item, :order => "created_at DESC",
36
- :conditions => 'published = true',
37
- :sortable => false,
38
- :searchable => true,
39
- :include => [:author],
40
- :paging => true,
41
- :search_conditions => ''
42
-
43
- end
44
-
45
- ## What can you configure with ``crudify``?
46
-
47
- ### ``:title_attribute``
48
-
49
- Default value is ``title``
50
-
51
- This is the human readable value you want ``crudify`` to use throughout. Just choose an attribute that is on your model that is short and descriptive to what the model is.
52
-
53
- #### Example
54
-
55
- On a page model you'd probably use "title" (which is default so you don't need to specify this)
56
-
57
- #### Example 2
58
-
59
- On a ``team_member`` model you'd probably want to use an attribute like ``name``.
60
-
61
- ### ``:order``
62
-
63
- Default value is ``position ASC``
64
-
65
- This is the position that is used when listing out what you're crudifying. If you have ``:sortable`` set to ``true`` you probably want to have your ``:order`` set to ``position ASC`` so it uses the order you have set when sorting.
66
-
67
- If you have a news area, it makes more sense to sort by ``posted_at``. So you might set it like this
68
-
69
- :order => "posted_at DESC"
70
-
71
- ### ``:conditions``
72
-
73
- Default value is ``nil``
74
-
75
- This will filter down the list of items you have when you're asking for all records.
76
-
77
- An example here is say you're crudifying a photos table that uses attachment_fu. Attachment_fu creates several photo records, 1 for the main photo and others for it's "children" thumbnails. Those thumbnails have a parent id set.
78
-
79
- So when viewing a list of the images you have you don't want it to show all the thumbnails too, you just want to each see unique image listed so you need to apply some conditions to hide the thumbnails.
80
-
81
- You do that like this:
82
-
83
- :conditions => {:parent_id => nil}
84
-
85
- ### ``:sortable``
86
-
87
- Default value is ``true``
88
-
89
- Enabling ``:sortable`` gives you several handy methods which "just work" with sortable JavaScript lists. One of the methods is ``update_positions()`` which handles saving the new position items have been sorted into.
90
-
91
- ### ``:searchable``
92
-
93
- Default value is ``true``
94
-
95
- When this option is ``true``, the routes are modified so when you go to the next page of results the search continues on.
96
-
97
- ### ``:include``
98
-
99
- Default value is ``[]``
100
-
101
- For performance optimisation, sometimes you might want to eager load other related models to this one. For example a ``news_post`` might below to a ``user`` who wrote the post. But in our index view we're printing out the name of each user.
102
-
103
- Instead of having to look up each user for each of the ``news_posts`` we iterate over, the ``:include`` option allows you to load the ``news_post`` and user all at the same time which'll allow you to save on expensive database queries.
104
-
105
- Here's an example of that.
106
-
107
- class NewsItem
108
-
109
- belongs_to :user
110
-
111
- end
112
-
113
- class NewsItemsController < ApplicationController
114
-
115
- crudify :news_item, :order => "created_at DESC", :include => [:user]
116
-
117
- end
118
-
119
- ### ``:paging``
120
-
121
- Default value is ``true``
122
-
123
- The ``:paging`` option tells ``crudify`` you don't just want one big long list but rather to break it out into pages and support paging methods uses [will_paginate](http://wiki.github.com/mislav/will_paginate/).
124
-
125
- ### ``:search_conditions``
126
-
127
- Default value is ``nil``
128
-
129
- Similar to the ``:conditions`` options, ``:search_conditions`` just apply these conditions when delivering search results.
130
-
131
- ## Easy Accessor Methods
132
-
133
- ``crudify`` automatically writes up finder methods for the model you're crudifying. The easier way to explain this is with an example.
134
-
135
- Say we have a pages controller that is going to manage pages.
136
-
137
- class PagesController < ApplicationController
138
-
139
- crudify :page
140
-
141
- end
142
-
143
- In this controller, automatically I have these methods:
144
-
145
- find_page()
146
- find_all_pages()
147
-
148
- So say I wanted to change the way all pages are found, all I do is override the ``find_all_pages`` method.
149
-
150
- class PagesController < ApplicationController
151
-
152
- crudify :page
153
-
154
- def find_all_pages
155
- @pages = Page.find(...) # apply any logic I want here to get all pages.
156
- end
157
-
158
- end
159
-
160
- ## Overriding or Extending Crudify
161
-
162
- Before overriding anything, the best thing to do is check out how the default works. Read the ``vendor/plugins/refinery/lib/crud.rb`` and see what code it's injecting into your controller.
163
-
164
- Pick the method you want to override and then override it in your controller.
165
-
166
- Let's go back to the example above with the pages controller.
167
-
168
- class PagesController < ApplicationController
169
-
170
- crudify :page
171
-
172
- end
173
-
174
- Say every time someone deletes a page I want my ``NotificationMailer`` to email me to say someone just deleted a page.
175
-
176
- When I look in the ``crud.rb`` file I see that my controller has this added to it
177
-
178
- def destroy
179
- flash.notice = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully deleted." if @#{singular_name}.destroy
180
- redirect_to admin_#{plural_name}_url
181
- end
182
-
183
- To override this all I would is create my own delete method that works the same but just with my mailer code on it.
184
-
185
- class PagesController < ApplicationController
186
-
187
- crudify :page
188
-
189
- def destroy
190
- if @page.destroy
191
- flash.notice = "'#{@page.title}' was successfully deleted."
192
- NotificationMailer.deliver_page_deleted(@page) # sends me an email to say a page was deleted
193
- end
194
- redirect_to admin_pages_url
195
- end
196
-
197
- end
data/engines.md DELETED
@@ -1,179 +0,0 @@
1
- # Extending Refinery with Engines
2
-
3
- ## Introduction
4
-
5
- __Refinery is designed to be easily extended so you can quickly customise your Refinery site to manage new areas you want to add to your site. If you see something you want to customise, the chances are you can customise it.__
6
-
7
- The main way of extending Refinery is through adding new engines to your app. By default you can edit pages in Refinery's backend, but how do you add a new section to manage like products?
8
-
9
- See: [The Refinery Engine Generator](http://github.com/resolve/refinerycms-generators/blob/master/readme.md#readme)
10
-
11
- ## The Structure of an Engine
12
-
13
- Think of a engine in Refinery as a small Rails app. Engines have a structure that is extremely similar to a Rails app. Here's an example of Refinery's pages engine (located in Refinery's ``pages/`` folder)
14
-
15
- pages
16
- |- app
17
- | |- controllers
18
- | | |- admin
19
- | | | |- pages_dialogs_controller.rb
20
- | | | |- page_parts_controller.rb
21
- | | | |- pages_controller.rb
22
- | | |- pages_controller.rb
23
- | |- helpers
24
- | | |- pages_helper.rb
25
- | |- models
26
- | | |- page.rb
27
- | |- views
28
- | |- pages
29
- | | |- home.html.erb
30
- | | |- show.html.erb
31
- | |- admin
32
- | |- pages
33
- | |- _form.html.erb
34
- | |- edit.html.erb
35
- | |- index.html.erb
36
- | |- new.html.erb
37
- |- config
38
- | |- routes.rb
39
- |- rails
40
- |- init.rb
41
-
42
-
43
- ### app/controllers
44
-
45
- In this example you see one "public" controller ``app/controllers/pages_controller`` that is responsible for managing the front end when I view a page.
46
-
47
- ### app/controllers/admin
48
-
49
- This bit is important. It's where all the controllers are held to manage pages in the Refinery back end in this example. You can ignore the ``pages_dialogs_controller.rb`` and ``page_parts_controller.rb`` for now and let's just focus on the ``admin/pages_controller.rb`` file. Here's what that looks like inside at a basic level:
50
-
51
- module Admin
52
- class PagesController < Admin::BaseController
53
-
54
- crudify :page, :conditions => {:parent_id => nil},
55
- :order => "position ASC", :paging => false
56
-
57
- end
58
- end
59
-
60
- This single controller allows us to create, read, update and delete pages in the backend. With a little bit of Refinery magic we utilise the [crudify mixin](http://github.com/resolve/refinerycms/blob/master/core/crud.md) which gives us all of these regular features out of the box.
61
-
62
- How crudify works is an entire topic of it's own. Checkout the [crudify documentation](http://github.com/resolve/refinerycms/blob/master/core/crud.md) to get an insight into how that works.
63
-
64
- ### app/views and app/helpers
65
-
66
- Works exactly the same as ``app/views`` and ``app/helpers`` in a normal Rails app. You just put the views and helpers related to this engine in here instead of in your actual main app directory.
67
-
68
- ### config/routes.rb
69
-
70
- Works exactly the same as ``config/routes.rb`` in your app except this routes file only loads the routes for this engine.
71
-
72
- ### rails/init.rb
73
-
74
- This file runs when your site is started up. All is does is registers this engine with Refinery so it knows that it exists, how to handle it in the Refinery admin menu and how to render recent activity on the Dashboard (see "Getting your Engine to Report Activity in the Dashboard")
75
-
76
- NOTE: The latest version of Refinery requires that you only specify a engine.name. plugin.title &amp; plugin.description will be looked up by the I18n system.
77
-
78
- # pages/lib/pages.rb
79
- ::Refinery::Plugin.register do |plugin|
80
- plugin.name = "pages"
81
- plugin.version = 1.0
82
- plugin.menu_match = /(refinery|admin)\/page(_dialog|part)?s$/
83
- plugin.activity = {
84
- :class => Page,
85
- :url_prefix => "edit_",
86
- :title => "title",
87
- :created_image => "page_add.png",
88
- :updated_image => "page_edit.png"
89
- }
90
- end
91
-
92
- # pages/config/locales/en.yml
93
- en:
94
- plugins:
95
- refinery_pages:
96
- title: Pages
97
- description: Manage content pages
98
-
99
- ## Getting your Engine to Report Activity in the Dashboard
100
-
101
- Recent activity reporting is built right in, so all you need to do is follow the convention below and your engine will start showing up in the recent activity list of the Dashboard.
102
-
103
- In our example above we showed the use of ``plugin.activity`` for the pages engine.
104
-
105
- ::Refinery::Plugin.register do |plugin|
106
- plugin.name = "pages"
107
- plugin.version = 1.0
108
- plugin.menu_match = /(refinery|admin)\/page(_dialog|part)?s$/
109
- plugin.activity = {
110
- :class => Page,
111
- :url_prefix => "edit_",
112
- :title => "title",
113
- :created_image => "page_add.png",
114
- :updated_image => "page_edit.png"
115
- }
116
- end
117
-
118
- Here's what the different activity options mean:
119
-
120
- ### Required
121
-
122
- :class
123
- # the name of the class we're watching.
124
-
125
- :url_prefix
126
- # Just use "edit_" if you're not sure how this works.
127
- #
128
- # When it says "'About' page was updated about 4 hours ago", the page title "About"
129
- # is linked to that page in a way we specify. So by setting "_edit" as a :url_prefix what
130
- # we're doing is making it link to the page that allows us to edit this page.
131
- # So the next result is edit_admin_page_url(page)
132
-
133
- :title
134
- # which attribute on the :class should be in the activty message. In our case it's "title"
135
- # because we want it to run something like this "#{page.title} was updated about ...."
136
-
137
- ### Optional
138
-
139
- :created_image and :updated_image
140
- # the activity monitor knows if something is created or updated and shows a different icon
141
- # depending on how you want that to look. You can specify the filename to any image you
142
- # want in the public/images/refinery/icons/ directory.
143
-
144
- ## Search Engine Optimisation: Improving the default URLs
145
-
146
- In our example above we extended Refinery to manage a products area. The problem is when I look at a product on the front end I get a URL like [http://localhost:3000/products/1](http://localhost:3000/products/1) but I would really like it to be something like [http://localhost:3000/products/my-product](http://localhost:3000/products/my-product)
147
-
148
- To achieve this all you need to do is open up the product model (found in ``/vendor/plugins/products/app/models/product.rb``) and add the following line inside your class:
149
-
150
- has_friendly_id :title, :use_slug => true
151
-
152
- Note you want to change ``:title`` to the field which you want to show up in the URL.
153
-
154
- This will work just fine for new products added from this point, but you'll want to migrate any existing products you have to use this new URL format. All you have to do is save each product you have in the database to make it create a nice URL for you.
155
-
156
- ruby script/console
157
- >> Product.all.each {|p| p.save };nil
158
-
159
- Now all the products in your database will have nice URLs.
160
-
161
- ## How to get a WYSIWYG editor to show on your form fields
162
-
163
- Refinery uses a standards compliant visual editor called [WYMeditor](http://www.wymeditor.org/)
164
-
165
- _Note: When using the Refinery generator, if you apply a field type of "text" to any of your fields, they automatically load as a WYMEditor._
166
-
167
- The WYSIWYG editor can only be applied to a ``textarea``. All you need to do is add a class of "wymeditor widest" to a ``textarea`` in your form and a WYSIWYG WYMEditor will load right in place.
168
-
169
- ### Example
170
-
171
- Again going back to our product plugin example if you had this in your ``vendor/plugins/products/app/views/admin/products/_form.html.erb`` file:
172
-
173
- <%= f.text_area :description %>
174
-
175
- Just change that to:
176
-
177
- <%= f.text_area :description, :class => "wymeditor widest" %>
178
-
179
- Refresh and you're done.