def generate_bottom_row(self): file_upload = file_upload_progress() success = html.span(class_='text-success hide', data={'success-text': 1}, *[self.success_message]) add_photo = html.button(class_='btn-attach-file file-related transition-color', data={'attach-btn': 1}, *[ html.i(class_='icon-picture'), u'Add photo\u2026' ]) char_count = self.generate_char_count() create_button = html.button(tabindex='2', data={'submit-button': 1}, class_='btn btn-primary %s-button btn-small disabled' % (self.btn_action.lower()), *[ self.btn_action ]) return html.grid(*[ html.div(class_='yui3-u-1-4 ta-left m-yui3-u-none', *[char_count]), html.div(class_='yui3-u-3-4 ta-right m-yui3-u-1', *[ file_upload, success, add_photo, create_button, ]) ])
def unauthenticated_button(self): csrf_token = get_token(self.request) tree = html.form(method='POST', *[ html.input(type='hidden', name='csrfmiddlewaretoken', value=csrf_token), html.input(type='hidden', name='action', value='redirect_to_signup'), html.input(type='hidden', name='user_id', value=unicode(self.target_id)), html.button(class_=self.default_button_classes + ['btn-primary'], *[ html.span(class_='text-follow', *[ "Follow" ]) ]) ]) return tree
def generate_html(self): if not self.is_authenticated and self.show_for_unauthenticated: return self.unauthenticated_button() if not self.is_authenticated or self.target_id == self.request.user.adn_user.id: return '' if self.is_following: data_follow_status = "1" following_class = "following" else: data_follow_status = "0" following_class = '' data = { 'follow-status': data_follow_status, 'user-id': self.target_id, 'follow-btn': '' } data.update(self.click_data) classes = self.default_button_classes + [following_class] if self.extra_classes: classes.extend(self.extra_classes) if not self.is_following: classes.append('btn-primary') tree = html.button(class_=classes, data=data, *[ html.span(class_='text-follow', *[ "Follow" ]), html.span(class_='text-unfollow', *[ "Unfollow" ]) ]) return tree