Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/issue-1179-cache-outbound-message…
Browse files Browse the repository at this point in the history
…-on-event
  • Loading branch information
hodgestar committed May 20, 2015
2 parents fc7d67f + 6aed48b commit d127d5e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions go/apps/bulk_message/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_action_bulk_send_view(self):
self.assertContains(response, 'name="message"')
self.assertContains(response, '<h1>Write and send bulk message</h1>')
self.assertContains(response, 'name="delivery_class"')
self.assertContains(response, 'Channel type')
self.assertContains(response,
'<option value="sms" selected="selected">SMS<')
self.assertContains(response, 'name="dedupe"')
Expand Down
1 change: 1 addition & 0 deletions go/apps/bulk_message/view_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class MessageForm(forms.Form):
message = forms.CharField(widget=BulkMessageWidget)
delivery_class = forms.ChoiceField(
label="Channel type",
required=True,
initial=DEFAULT_BULK_SEND_DELIVERY_CLASS,
choices=[(d_name, d['label']) for d_name, d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<input
class="store-as form-control"
type="text"
name=""
value="<%= model.get("store_as") %>"
placeholder='labelname'>
</div>
Expand Down
5 changes: 5 additions & 0 deletions go/conversation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ def test_edit_conversation_details_submit_invalid_form(self):
self.assertEqual(reloaded_conv.name, 'test-name')
self.assertEqual(reloaded_conv.description, 'test-desc')

def test_edit_fallback(self):
conv = self.user_helper.create_conversation(u'dummy')
response = self.client.get(self.get_view_url(conv, 'edit'))
self.assertRedirects(response, self.get_view_url(conv, 'show'))

def test_conversation_contact_group_listing(self):
conv = self.user_helper.create_conversation(
u'dummy', name=u'test', description=u'test')
Expand Down
16 changes: 16 additions & 0 deletions go/conversation/view_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,20 @@ def wrapper(self, request, conversation, *args, **kw):
return wrapper


class FallbackEditConversationView(ConversationApiView):
"""A fallback 'edit' view that redirects to the 'show' view.
For use on conversation types that have no custom edit
view to prevent 404s from occurring if another part of
the user interface directs a person to the edit view.
"""
view_name = 'edit'
path_suffix = 'edit/'

def get(self, request, conversation):
return self.redirect_to('show', conversation_key=conversation.key)


class ConversationActionView(ConversationTemplateView):
"""View for performing an arbitrary conversation action.
Expand Down Expand Up @@ -762,6 +776,8 @@ def __init__(self, conv_def):
self._views = list(self.DEFAULT_CONVERSATION_VIEWS)
if self.edit_view is not None:
self._views.append(self.edit_view)
else:
self._views.append(FallbackEditConversationView)
self._views.extend(self.extra_views)

self._view_mapping = {}
Expand Down

0 comments on commit d127d5e

Please sign in to comment.