allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [04/11] allura git commit: [#5461] show the relevant artifact type in the checkbox label
Date Thu, 03 Jan 2019 14:57:09 GMT
[#5461] show the relevant artifact type in the checkbox label


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3e066d0d
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3e066d0d
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3e066d0d

Branch: refs/heads/master
Commit: 3e066d0d9d33970d68e2eb64810dc8552eb21a0e
Parents: b451b99
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Dec 19 12:07:19 2018 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Dec 19 12:08:05 2018 -0500

----------------------------------------------------------------------
 Allura/allura/model/artifact.py                    | 8 ++++++++
 Allura/allura/templates/widgets/edit_post.html     | 4 ++--
 Allura/allura/templates/widgets/post_thread.html   | 4 ++--
 Allura/allura/templates/widgets/post_widget.html   | 7 ++++---
 Allura/allura/templates/widgets/thread_widget.html | 6 +++---
 ForgeDiscussion/forgediscussion/model/forum.py     | 4 ++++
 ForgeWiki/forgewiki/model/wiki.py                  | 4 ++++
 7 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 74480f5..8ae24c6 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -329,6 +329,14 @@ class Artifact(MappedClass, SearchIndexable):
             snippet_s='',
             deleted_b=self.deleted)
 
+    @property
+    def type_name(self):
+        """
+        :return: a presentation name for this type of artifact
+        :rtype: str
+        """
+        return self.type_s.lower()
+
     def url(self):
         """Return the URL for this Artifact.
 

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/Allura/allura/templates/widgets/edit_post.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/edit_post.html b/Allura/allura/templates/widgets/edit_post.html
index 939ed3d..63181b8 100644
--- a/Allura/allura/templates/widgets/edit_post.html
+++ b/Allura/allura/templates/widgets/edit_post.html
@@ -32,10 +32,10 @@
     <input type="file" class="text attachment_form_fields" style="display:none" multiple
name="{{att_name}}" {% if att_id %}id="{{att_id}}"{% endif %}/>
     <br>
     <input type="submit" value="{{submit_text}}" />
-    {% if c.user and c.user != c.user.anonymous() %}
+    {% if primary_artifact and c.user and c.user != c.user.anonymous() %}
       {# TODO: if not already subscribed (to artifact, or to whole tool) #}
       <label class="subscribe">
-        <input type="checkbox" checked name="subscribe">Subscribe to this topic
+        <input type="checkbox" checked name="subscribe">Subscribe to this {{ primary_artifact.type_name
}}
       </label>
     {% endif %}
     <a href="#" class="ui-button btn link cancel_edit_post">Cancel</a>

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/Allura/allura/templates/widgets/post_thread.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_thread.html b/Allura/allura/templates/widgets/post_thread.html
index 40bc774..c593803 100644
--- a/Allura/allura/templates/widgets/post_thread.html
+++ b/Allura/allura/templates/widgets/post_thread.html
@@ -20,12 +20,12 @@
 <li>
 {{widget.parent_widget.widgets.post.display(
     value=value, show_subject=show_subject, indent=indent,
-    page=page, limit=limit)}}
+    page=page, limit=limit, primary_artifact=primary_artifact)}}
     <!-- post_thread replies -->
     <ul>
       {%- if children %}
       {%- for child in children %}
-      {{widget.display(value=child.post, children=child.children, indent=indent+1)}}
+      {{widget.display(value=child.post, children=child.children, indent=indent+1, primary_artifact=primary_artifact)}}
       {%- endfor %}
       {%- endif %}
     </ul>

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index bcca961..b6f6970 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -95,7 +95,7 @@
         </div>
         {% if h.has_access(value, 'moderate')() %}
         <div class="edit_post_form reply" style="display:none; padding-left: 5px;">
-            {{widgets.edit_post.display(value=value, submit_text='Post', action=value.url())}}
+            {{widgets.edit_post.display(value=value, submit_text='Post', action=value.url(),
primary_artifact=primary_artifact)}}
         </div>
         {% endif %}
         {% if h.has_access(value, 'moderate')() %}
@@ -166,8 +166,9 @@
                 submit_text='Post Reply',
                 action=value.url()+'reply',
                 value=dict(
-                text='',
-                subject=value.reply_subject()),
+                    text='',
+                    subject=value.reply_subject()),
+                primary_artifact=primary_artifact,
               )}}
             </div>
           </div>

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/Allura/allura/templates/widgets/thread_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/thread_widget.html b/Allura/allura/templates/widgets/thread_widget.html
index d060c4d..2bd0f65 100644
--- a/Allura/allura/templates/widgets/thread_widget.html
+++ b/Allura/allura/templates/widgets/thread_widget.html
@@ -17,7 +17,7 @@
        under the License.
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
-
+{% set primary_artifact = value.primary() %}
 <div>
   <div class="comment-row">
       {% if limit %}
@@ -30,7 +30,7 @@
             <ul>
               {{widgets.post_thread.display(value=t['post'], children=t['children'],
                   indent=0, show_subject=show_subject,
-                  page=page, limit=limit)}}
+                  page=page, limit=limit, primary_artifact=primary_artifact)}}
             </ul>
             {% endfor %}
           {% endif %}
@@ -61,7 +61,7 @@
           </p>
         </div>
         <div class="grid-17">
-            {{widgets.edit_post.display(submit_text='Post', action=value.url() + 'post')}}
+            {{widgets.edit_post.display(submit_text='Post', action=value.url() + 'post',
primary_artifact=primary_artifact)}}
         </div>
       </div>
     </div>

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/ForgeDiscussion/forgediscussion/model/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index 96728ee..94cb053 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -164,6 +164,10 @@ class ForumThread(M.Thread):
     first_post = RelationProperty('ForumPost', via='first_post_id')
 
     @property
+    def type_name(self):
+        return 'topic'
+
+    @property
     def status(self):
         if len(self.posts) == 1:
             return self.posts[0].status

http://git-wip-us.apache.org/repos/asf/allura/blob/3e066d0d/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index bb9f452..bad7a72 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -119,6 +119,10 @@ class Page(VersionedArtifact, ActivityObject):
         return 'a wiki page'
 
     @property
+    def type_name(self):
+        return 'wiki page'
+
+    @property
     def activity_extras(self):
         d = ActivityObject.activity_extras.fget(self)
         d.update(summary=self.title)


Mime
View raw message