From f3e88be80117897d56c6718067f7cf71311c1c67 Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 27 Jan 2015 09:10:04 +0000 Subject: [PATCH] - Included the edit link into the foundry-base theme - Added documentation to the tag in Foundry git-svn-id: https://svn.libreccm.org/ccm/trunk@3105 8810af33-2d31-482b-a856-94f89814c4df --- .../foundry-base/styles/screen/public.css | 31 +++++++- .../content-items/article-detail-nav.xml | 2 + .../content-items/article-detail.xml | 8 +- .../content-items/bookmark-detail.xml | 3 + .../content-items/decisiontree-detail.xml | 2 + .../content-items/detail-default.xml | 3 + .../templates/content-items/event-detail.xml | 2 + .../templates/content-items/fsi-detail.xml | 2 + .../templates/content-items/mpa-detail.xml | 2 + .../templates/content-items/news-detail.xml | 2 + .../content-items/pressrelease-detail.xml | 2 + .../content-items/siteproxy-detail.xml | 3 + .../templates/fragments/edit-link.xml | 8 ++ .../web/themes/foundry-base/texts/global.xml | 4 +- .../lib/template-tags/content-items.xsl | 77 ++++++++++++++++++- .../navigation/DataCollectionRenderer.java | 7 +- 16 files changed, 141 insertions(+), 17 deletions(-) create mode 100644 ccm-core/web/themes/foundry-base/templates/fragments/edit-link.xml diff --git a/ccm-core/web/themes/foundry-base/styles/screen/public.css b/ccm-core/web/themes/foundry-base/styles/screen/public.css index 68559d8c3..5ef022aff 100644 --- a/ccm-core/web/themes/foundry-base/styles/screen/public.css +++ b/ccm-core/web/themes/foundry-base/styles/screen/public.css @@ -290,6 +290,35 @@ main nav ul li.active:after { border-color:transparent #ff9840; } +main { + position: relative; +} + +main .edit-link { + display: none; +} + +main:hover .edit-link { + display: block; + position: absolute; + right: 0; + top: 0; + font-size: 30px; + color: #0776a0; + border: 1px solid #0776a0; + width: 32px; + height: 32px; + text-align: center; +} + +main:hover .edit-link a:link, +main:hover .edit-link a:hover, +main:hover .edit-link a:active, +main:hover .edit-link a:visited { + color: #0776a0; + text-decoration: none; +} + footer { margin: 0; padding-bottom: 0; @@ -324,7 +353,7 @@ footer div#breadcrumbs a, footer div#breadcrumbs a:link { text-decoration: none; color: #fff; - + } footer div#breadcrumbs a:active, diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/article-detail-nav.xml b/ccm-core/web/themes/foundry-base/templates/content-items/article-detail-nav.xml index 14511385f..cadff37ad 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/article-detail-nav.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/article-detail-nav.xml @@ -5,6 +5,8 @@ --> + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/article-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/article-detail.xml index ce5a74631..6d304638e 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/article-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/article-detail.xml @@ -5,13 +5,7 @@ --> - - - +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/bookmark-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/bookmark-detail.xml index af813c9ae..a9e7591f4 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/bookmark-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/bookmark-detail.xml @@ -7,6 +7,9 @@ + + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/decisiontree-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/decisiontree-detail.xml index 98dbc5237..26b8cd15e 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/decisiontree-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/decisiontree-detail.xml @@ -5,6 +5,8 @@ --> + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/detail-default.xml b/ccm-core/web/themes/foundry-base/templates/content-items/detail-default.xml index 1b59004d2..501549dd2 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/detail-default.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/detail-default.xml @@ -3,6 +3,9 @@ + + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/event-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/event-detail.xml index 7aa67d210..a820b4016 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/event-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/event-detail.xml @@ -5,6 +5,8 @@ + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/fsi-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/fsi-detail.xml index 8230bf070..39d31402f 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/fsi-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/fsi-detail.xml @@ -5,6 +5,8 @@
+ + links/view diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/mpa-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/mpa-detail.xml index 5150115a0..4a50a8297 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/mpa-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/mpa-detail.xml @@ -5,6 +5,8 @@ + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/news-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/news-detail.xml index cec385d38..7ca942fbb 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/news-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/news-detail.xml @@ -5,6 +5,8 @@ + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/pressrelease-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/pressrelease-detail.xml index 698cf267c..773ff2076 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/pressrelease-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/pressrelease-detail.xml @@ -5,6 +5,8 @@ + +
diff --git a/ccm-core/web/themes/foundry-base/templates/content-items/siteproxy-detail.xml b/ccm-core/web/themes/foundry-base/templates/content-items/siteproxy-detail.xml index 98643d65f..95e9a4cb9 100644 --- a/ccm-core/web/themes/foundry-base/templates/content-items/siteproxy-detail.xml +++ b/ccm-core/web/themes/foundry-base/templates/content-items/siteproxy-detail.xml @@ -1,5 +1,8 @@ + + +
diff --git a/ccm-core/web/themes/foundry-base/templates/fragments/edit-link.xml b/ccm-core/web/themes/foundry-base/templates/fragments/edit-link.xml new file mode 100644 index 000000000..3f47fbac1 --- /dev/null +++ b/ccm-core/web/themes/foundry-base/templates/fragments/edit-link.xml @@ -0,0 +1,8 @@ + + + +
+ + \ No newline at end of file diff --git a/ccm-core/web/themes/foundry-base/texts/global.xml b/ccm-core/web/themes/foundry-base/texts/global.xml index 9f42da379..05842a88e 100644 --- a/ccm-core/web/themes/foundry-base/texts/global.xml +++ b/ccm-core/web/themes/foundry-base/texts/global.xml @@ -12,8 +12,8 @@ - Foundry - Foundry + LibreCMS + LibreCMS diff --git a/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items.xsl b/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items.xsl index 784633a69..9789eee1e 100644 --- a/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items.xsl +++ b/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items.xsl @@ -623,12 +623,80 @@

- Renders an link to edit an item in the content centre if the current user is - logged in and has the permission to edit the item. + Provides the href for creating a link to edit the current item in the + content centre if the current user is logged in and has the permission to edit the + item.

+

+ To use this feature put the following snippet like the following into the + templates for the content items in your theme: +

+
+                <edit-link>
+                    <div class="edit-link">
+                        <a>
+                            <a>
+                                &#x270e;
+                            </a>
+                        </a>
+                    </div>
+                </edit-link>
+            
+

+ The example uses an UTF-8 character from the Dingbats block (a pencil). + You can of course use another character, text or an image. To + reduce the amount of code needed you may add a fragment template and include this + template using the include tag. +

+

+ You also have to include styles for the edit link into your theme. + The foundry-base theme, for example, puts the edit link the top right + corner of the area which shows the content item. This is done by the following + styles: +

+
+                /* Sets the reference point for position: absolute 
+                   to the main element block */
+                main {
+                    position: relative;
+                }
+
+                /* Don't show the edit link on a first glance */
+                main .edit-link {
+                    display: none;
+                }
+
+                /* Display the edit link in the top right corner 
+                    of the content item area if the cursor is in 
+                    the content item area */
+                main:hover .edit-link {
+                    display: block; 
+                    position: absolute;
+                    right: 0;
+                    top: 0;
+                    font-size: 30px;
+                    color: #0776a0;
+                    /* Blue border around the link */
+                    border: 1px solid #0776a0; 
+                    /* Make the link 32px in width and height */
+                    width: 32px; 
+                    height: 32px;
+                    text-align: center;
+                }
+
+                /* Remove default decoration for links */
+                main:hover .edit-link a:link,
+                main:hover .edit-link a:hover,
+                main:hover .edit-link a:active, 
+                main:hover .edit-link a:visited {
+                    color: #0776a0;
+                    text-decoration: none;
+                }
+
+            
- + @@ -636,7 +704,8 @@ + select="concat($context-prefix, '/ccm', + $contentitem-tree/editLink)"/> diff --git a/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java b/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java index a0094d023..fd7e93b1f 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java +++ b/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java @@ -243,9 +243,7 @@ public class DataCollectionRenderer extends LockableImpl { } final Element item = Navigation.newElement(content, "item"); - // Create a canEdit link if the current user is permitted to edit the item. - // Note: Works only when list specializes the object because an ACSObject instance is needed for creating - // the PermissionDescriptor. + // Create a canEdit attribute if the current user is permitted to edit the item. Party currentParty = Kernel.getContext().getParty(); if (currentParty == null) { currentParty = Kernel.getPublicUser(); @@ -255,6 +253,9 @@ public class DataCollectionRenderer extends LockableImpl { edit = new PermissionDescriptor(PrivilegeDescriptor.get( com.arsdigita.cms.SecurityManager.CMS_EDIT_ITEM), dobj.getOID(), currentParty.getOID()); } else { + //Create a link for editing the item. Works only if the item is specalised because + //the ItemResolver provided by the ContentSection of the item is needed for creating + //the link. edit = new PermissionDescriptor(PrivilegeDescriptor.get( com.arsdigita.cms.SecurityManager.CMS_EDIT_ITEM), object, currentParty); if (PermissionService.checkPermission(edit) && (object instanceof ContentItem)) {