]> git.mxchange.org Git - friendica.git/commitdiff
group_side - unify look with forumlist
authorrabuzarus <>
Sat, 28 Nov 2015 19:09:28 +0000 (20:09 +0100)
committerrabuzarus <>
Sat, 28 Nov 2015 19:09:28 +0000 (20:09 +0100)
include/group.php
mod/contacts.php
mod/group.php
mod/network.php
mod/nogroup.php
view/templates/group_side.tpl
view/theme/smoothly/style.css
view/theme/vier/style.css

index fe29d39f1a810ae86eb6ec5ef66d630c7538831e..862d06818dd0957bb8a7428f3a7c7b996b953e89 100644 (file)
@@ -213,9 +213,20 @@ function mini_group_select($uid,$gid = 0) {
 }
 
 
-
-
-function group_side($every="contacts",$each="group",$edit = false, $group_id = 0, $cid = 0) {
+/**
+ * @brief Create group sidebar widget
+ * 
+ * @param string $every
+ * @param string $each
+ * @param string $editmode
+ *     'standard' => include link 'Edit groups'
+ *     'extended' => include link 'Create new group'
+ *     'full' => include link 'Create new group' and provide for each group a link to edit this group
+ * @param int $group_id
+ * @param int $cid
+ * @return string
+ */
+function group_side($every="contacts",$each="group",$editmode = "standard", $group_id = 0, $cid = 0) {
 
        $o = '';
 
@@ -239,13 +250,13 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
        $member_of = array();
        if($cid) {
                $member_of = groups_containing(local_user(),$cid);
-       } 
+       }
 
        if(count($r)) {
                foreach($r as $rr) {
                        $selected = (($group_id == $rr['id']) ? ' group-selected' : '');
                        
-                       if ($edit) {
+                       if ($editmode == "full") {
                                $groupedit = array(
                                        'href' => "group/".$rr['id'],
                                        'title' => t('edit'),
@@ -269,14 +280,17 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
 
        $tpl = get_markup_template("group_side.tpl");
        $o = replace_macros($tpl, array(
-               '$title'                => t('Groups'),
+               '$title'        => t('Groups'),
+               'newgroup'      => (($editmode == "extended") || ($editmode == "full") ? 1 : ''),
+               '$editgroupstext' => t('Edit groups'),
+               'grouppage'     => "group/",
                '$edittext'     => t('Edit group'),
                '$createtext'   => t('Create a new group'),
-    '$creategroup' => t('Group Name: '),
-    '$form_security_token' => get_form_security_token("group_edit"),
+               '$creategroup'  => t('Group Name: '),
+               '$form_security_token' => get_form_security_token("group_edit"),
                '$ungrouped'    => (($every === 'contacts') ? t('Contacts not in any group') : ''),
-               '$groups'               => $groups,
-               '$add'                  => t('add'),
+               '$groups'       => $groups,
+               '$add'          => t('add'),
        ));
 
 
index 017b1d6435fd8456953d3fadcc312312fdc0b6e7..1dc886363ae1ddf699f4aa41a19a6a4d6c799e9f 100644 (file)
@@ -55,7 +55,7 @@ function contacts_init(&$a) {
                $findpeople_widget .= findpeople_widget();
        }
 
-       $groups_widget .= group_side('contacts','group',false,0,$contact_id);
+       $groups_widget .= group_side('contacts','group','full',0,$contact_id);
        
        $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
                '$vcard_widget' => $vcard_widget,
index 263586e2e903458f1cf7627a8849ffc4bdc64149..e9f9561f4613eaa0728b06f5e1113828e1cb7c15 100644 (file)
@@ -7,7 +7,7 @@ function validate_members(&$item) {
 function group_init(&$a) {
        if(local_user()) {
                require_once('include/group.php');
-               $a->page['aside'] = group_side('contacts','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0));
+               $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
        }
 }
 
index 903ee4154839ca37493a89b02dbdf8e23fdb7630..fd22f3e192f7d0d9a8fa7f272b462c9cce9bdd4f 100644 (file)
@@ -145,7 +145,7 @@ function network_init(&$a) {
                ));
        }
 
-       $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : '');
+       $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
        $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : '');
        $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
        $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
index 06fa730e0d1a581ef7f3c1a8df8d678da6a2e029..9f6e9784331851b702434245f24256313612d6e4 100644 (file)
@@ -15,7 +15,7 @@ function nogroup_init(&$a) {
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
 
-       $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id);
+       $a->page['aside'] .= group_side('contacts','group','extended',0,$contact_id);
 }
 
 
index 4905c2fa1a1346fc2c8ccce86d67b00cceecd340..466882370f37d3961b2f0ae2522c70a372e199e6 100644 (file)
@@ -1,38 +1,42 @@
 <div class="widget" id="group-sidebar">
-<h3>{{$title}}</h3>
+       <h3>{{$title}}</h3>
 
-<div id="sidebar-group-list">
-       <ul role="menu" id="sidebar-group-ul">
-               {{foreach $groups as $group}}
-                       <li role="menuitem" class="sidebar-group-li group-{{$group.id}}">
-                               {{if $group.cid}}
-                                       <input type="checkbox"
-                                               class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
-                                               onclick="contactgroupChangeMember('{{$group.id}}','{{$group.cid}}');return true;"
-                                               {{if $group.ismember}}checked="checked"{{/if}}
-                                       />
-                               {{/if}}
-                               {{if $group.edit}}
-                                       <a class="groupsideedit" href="{{$group.edit.href}}" title="{{$edittext}}"><span id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span></a>
-                               {{/if}}
-                               <a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element {{if $group.selected}}group-selected{{/if}}" href="{{$group.href}}">{{$group.text}}</a>
-                               <span class="notify"></span>
-                       </li>
-               {{/foreach}}
-       </ul>
+       <div id="sidebar-group-list">
+               <ul role="menu" id="sidebar-group-ul">
+                       {{foreach $groups as $group}}
+                               <li role="menuitem" class="sidebar-group-li group-{{$group.id}}">
+                                       {{if ! $newgroup}}<span class="notify badge pull-right"></span>{{/if}}
+                                       {{if $group.cid}}
+                                               <input type="checkbox"
+                                                       class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
+                                                       onclick="contactgroupChangeMember('{{$group.id}}','{{$group.cid}}');return true;"
+                                                       {{if $group.ismember}}checked="checked"{{/if}}
+                                               />
+                                       {{/if}}
+                                       {{if $group.edit}}
+                                               <a class="groupsideedit" href="{{$group.edit.href}}" title="{{$edittext}}">
+                                                       <span id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span>
+                                               </a>
+                                       {{/if}}
+                                       <a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element {{if $group.selected}}group-selected{{/if}}" href="{{$group.href}}">{{$group.text}}</a>
+                               </li>
+                       {{/foreach}}
+               </ul>
        </div>
-  <div id="sidebar-new-group">
-  <a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a>
-  <form id="group-new-form" action="group/new" method="post" style="display:none;">
-   <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
-   <input name="groupname" id="id_groupname" placeholder="{{$creategroup}}">
-  </form>
-  </div>
-  {{if $ungrouped}}
-  <div id="sidebar-ungrouped">
-  <a href="nogroup">{{$ungrouped}}</a>
-  </div>
-  {{/if}}
+
+       {{if $newgroup}}
+       <div id="sidebar-new-group">
+               <a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a>
+               <form id="group-new-form" action="group/new" method="post" style="display:none;">
+                       <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+                       <input name="groupname" id="id_groupname" placeholder="{{$creategroup}}">
+               </form>
+       </div>
+       {{else}}
+       <div id="sidebar-edit-groups"><a href="{{$grouppage}}">{{$editgroupstext}}</a></div>
+       {{/if}}
+
+       {{if $ungrouped}}<div id="sidebar-ungrouped"><a href="nogroup">{{$ungrouped}}</a></div>{{/if}}
 </div>
 
 
index ba0c4bff6ec9ef2a4197b62191cc5f587467810d..3b6b73dc6e39eb6b63719ebee41d25c7b69ab9f9 100644 (file)
@@ -854,7 +854,8 @@ li.widget-list {
        padding: 3px 24px;
 }
 
-#sidebar-new-group {
+#sidebar-new-group,
+#sidebar-edit-groups {
        padding: 7px;
        width: 165px;
        margin: auto;
index ecbb2ad96cb8c156305dc69f9476911b71145ad9..5bd475759fff3d0a7ef4389e27cd4266e1306dc9 100644 (file)
@@ -347,7 +347,7 @@ code {
   display: inline-block;
   min-width: 10px;
   padding: 3px 7px;
-  font-size: 12px;
+  font-size: 10px;
   font-weight: 700;
   line-height: 1;
   color: #fff;
@@ -382,7 +382,7 @@ code {
 #sidebar-group-list .tool:hover {
        background: #EEE;
 }
-#sidebar-group-list .notify {
+/*#sidebar-group-list .notify {
        min-width: 10px;
        text-align: center;
        color: #FFF;
@@ -391,6 +391,9 @@ code {
        padding: 3px;
        border-radius: 10px;
        display: none;
+}*/
+#sidebar-group-list .notify {
+  display: none;
 }
 #sidebar-group-list .notify.show { display: inline-block; }
 .tool .label {
@@ -416,7 +419,7 @@ code {
   opacity: 1;
 }
 
-.sidebar-group-li:hover, #sidebar-new-group:hover, #forum-widget-collapse:hover,
+.sidebar-group-li:hover, #sidebar-new-group:hover, #sidebar-edit-groups:hover, #forum-widget-collapse:hover,
 #sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover,
 .nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover {
   /* background-color: #ddd; */
@@ -436,7 +439,7 @@ code {
   font-weight: bold;
 }
 
-#forum-widget-showmore, #sidebar-new-group, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped,
+#forum-widget-showmore, #sidebar-new-group, #sidebar-edit-groups, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped,
 .side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new {
   padding-left: 10px;
   padding-top: 3px;
@@ -464,7 +467,7 @@ code {
   display: inline-block;
 }
 
-a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a {
+a.nets-link, .side-link a, #sidebar-new-group a, #sidebar-edit-groups a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a {
   display: block;
   color: #737373;
 }