[IMP] : join group button is visible to public user if public user will click on join group will ask to login
[IMP] : button color [ADD] : 'Mailing List' menu in footer bzr revid: aja@tinyerp.com-20140313092505-yr2uwmxafudtdju9
This commit is contained in:
parent
a8f130a2a8
commit
633ceff7fc
|
@ -45,6 +45,9 @@ class MailGroup(http.Controller):
|
||||||
def subscription(self, group_id=0, action=False ,**post):
|
def subscription(self, group_id=0, action=False ,**post):
|
||||||
cr, uid, context = request.cr, request.uid, request.context
|
cr, uid, context = request.cr, request.uid, request.context
|
||||||
group_obj = request.registry.get('mail.group')
|
group_obj = request.registry.get('mail.group')
|
||||||
|
public_uid = request.registry['website'].get_public_user(cr , uid, context)
|
||||||
|
if uid == public_uid:
|
||||||
|
return ['is_public']
|
||||||
if action:
|
if action:
|
||||||
group_obj.message_subscribe_users(cr, uid, [group_id], context=context)
|
group_obj.message_subscribe_users(cr, uid, [group_id], context=context)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -4,12 +4,14 @@ $(document).ready(function () {
|
||||||
var $link = $(ev.currentTarget);
|
var $link = $(ev.currentTarget);
|
||||||
var href = $link.attr("href");
|
var href = $link.attr("href");
|
||||||
var group_id = href.match(/subscription\/([0-9]+)/)[1];
|
var group_id = href.match(/subscription\/([0-9]+)/)[1];
|
||||||
var action = href.match(/action=(.*)/)[1] == 'follow' ? true : false;
|
var action = href.match(/action=(.*)/)[1] == 'subscribe' ? true : false;
|
||||||
openerp.jsonRpc("/groups/subscription/", 'call', {
|
openerp.jsonRpc("/groups/subscription/", 'call', {
|
||||||
'group_id': parseInt(group_id),
|
'group_id': parseInt(group_id),
|
||||||
'action' : action,
|
'action' : action,
|
||||||
})
|
})
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
|
if(data[0])
|
||||||
|
return window.location ='/web/login?redirect=/groups/';
|
||||||
if (action){
|
if (action){
|
||||||
$('li#'+ group_id).toggleClass('hidden visible');
|
$('li#'+ group_id).toggleClass('hidden visible');
|
||||||
$('.unfollow_' + group_id).toggleClass('visible hidden');
|
$('.unfollow_' + group_id).toggleClass('visible hidden');
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
<template id="footer_mailing_list" inherit_id="website.layout" name="Footer Mailing List Link">
|
||||||
|
<xpath expr="//footer//div[@name='info']/ul" position="inside">
|
||||||
|
<li><a t-attf-href="/groups">Mailing List</a></li>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
<template id="mail_groups" name="My Groups">
|
<template id="mail_groups" name="My Groups">
|
||||||
<t t-call="website.layout">
|
<t t-call="website.layout">
|
||||||
<t t-set="head">
|
<t t-set="head">
|
||||||
|
@ -16,8 +21,8 @@
|
||||||
<div>
|
<div>
|
||||||
<a t-attf-href="/groups/#{group.id}" t-esc="group.name"/>
|
<a t-attf-href="/groups/#{group.id}" t-esc="group.name"/>
|
||||||
<div t-esc="group.description" class="text-muted"/>
|
<div t-esc="group.description" class="text-muted"/>
|
||||||
<a groups="base.group_user" t-attf-class="btn btn-default js_group #{group.message_is_follower and 'hidden' or 'visible'} follow_#{group.id}" t-attf-href="/groups/subscription/#{ group.id }/?action=follow" t-attf-id="#{group.id}">Join Group</a>
|
<a t-attf-class="btn btn-primary js_group #{group.message_is_follower and 'hidden' or 'visible'} follow_#{group.id}" t-attf-href="/groups/subscription/#{ group.id }/?action=subscribe" t-attf-id="#{group.id}">Join Group</a>
|
||||||
<a groups="base.group_user" t-attf-class="btn btn-primary js_group #{group.message_is_follower and 'visible' or 'hidden'} unfollow_#{group.id}" t-attf-href="/groups/subscription/#{ group.id }/?action=unfollow" t-attf-id="#{group.id}">UnFollow</a>
|
<a t-attf-class="btn btn-default js_group #{group.message_is_follower and 'visible' or 'hidden'} unfollow_#{group.id}" t-attf-href="/groups/subscription/#{ group.id }/?action=unsubscribe" t-attf-id="#{group.id}">Unsubscribe</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,7 +46,7 @@
|
||||||
<ul class="nav nav-pills nav-stacked" id="group_follows">
|
<ul class="nav nav-pills nav-stacked" id="group_follows">
|
||||||
<t t-foreach="groups" t-as="group">
|
<t t-foreach="groups" t-as="group">
|
||||||
<li t-attf-class="#{group.message_is_follower and 'visible' or 'hidden'}" t-att-id="group.id">
|
<li t-attf-class="#{group.message_is_follower and 'visible' or 'hidden'}" t-att-id="group.id">
|
||||||
<a t-attf-href="/groups/#{group.id}" t-esc="group.name"/>
|
<a t-attf-href="/groups/#{ slug(group) }" t-esc="group.name"/>
|
||||||
</li>
|
</li>
|
||||||
</t>
|
</t>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -49,13 +54,13 @@
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<ul class="media-list">
|
<ul class="media-list">
|
||||||
<li t-foreach="thread_list" t-as="thread" class="media">
|
<li t-foreach="thread_list" t-as="thread" class="media">
|
||||||
<a t-attf-href="/groups/#{active_group.id}/message/#{thread.id}" class="pull-left">
|
<a t-attf-href="/groups/#{active_group.id}/message/#{ slug(thread) }" class="pull-left">
|
||||||
<img class="img-rounded pull-right mt0" style="height: 40px"
|
<img class="img-rounded pull-right mt0" style="height: 40px"
|
||||||
t-att-src="'/website/image?model=mail.message&field=author_avatar&id='+str(thread.id)"/>
|
t-att-src="'/website/image?model=mail.message&field=author_avatar&id='+str(thread.id)"/>
|
||||||
</a>
|
</a>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<h4 class="media-heading">
|
<h4 class="media-heading">
|
||||||
<a t-attf-href="/groups/#{active_group.id}/message/#{thread.id}" t-esc="thread.subject"/>
|
<a t-attf-href="/groups/#{ slug(active_group) }/message/#{ slug(thread) }" t-esc="thread.subject"/>
|
||||||
<br/>
|
<br/>
|
||||||
<small>by <t t-esc="thread.author_id.name and thread.author_id.name or thread.email_from"/> on <t t-esc="thread.date"/></small>
|
<small>by <t t-esc="thread.author_id.name and thread.author_id.name or thread.email_from"/> on <t t-esc="thread.date"/></small>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
Loading…
Reference in New Issue