gists: fixed cache problems and updated ui

This commit is contained in:
Marcin Kuzminski 2019-07-24 11:29:06 +02:00
parent f7c67dc6d9
commit fc1ae1d057
3 changed files with 20 additions and 18 deletions

View file

@ -432,8 +432,10 @@ class BaseRepository(object):
def append_commit_id(self, commit_id):
if commit_id not in self.commit_ids:
self._rebuild_cache(self.commit_ids + [commit_id])
# clear cache
self._invalidate_prop_cache('commit_ids')
# clear cache
self._invalidate_prop_cache('commit_ids')
self._is_empty = False
def get_commit(self, commit_id=None, commit_idx=None, pre_load=None, translate_tag=None):
"""

View file

@ -824,7 +824,7 @@ class RepoModel(BaseModel):
def _create_filesystem_repo(self, repo_name, repo_type, repo_group,
clone_uri=None, repo_store_location=None,
use_global_config=False):
use_global_config=False, install_hooks=True):
"""
makes repository on filesystem. It's group aware means it'll create
a repository within a group, and alter the paths accordingly of
@ -890,7 +890,8 @@ class RepoModel(BaseModel):
repo_path, config=config, create=True, src_url=clone_uri,
with_wire={"cache": False})
repo.install_hooks()
if install_hooks:
repo.install_hooks()
log.debug('Created repo %s with %s backend',
safe_unicode(repo_name), safe_unicode(repo_type))

View file

@ -8,9 +8,7 @@
%endif
</%def>
<%def name="breadcrumbs_links()">
${_('New Gist')}
</%def>
<%def name="breadcrumbs_links()"></%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='gists')}
@ -20,46 +18,47 @@
<div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
<div class="table">
<div id="files_data">
${h.secure_form(h.route_path('gists_create'), id='eform', request=request)}
<div>
<textarea id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
<span class="gist-gravatar">
${self.gravatar(c.rhodecode_user.email, 30)}
</span>
<label for='gistid'>${_('Gist id')}</label>
${h.text('gistid', placeholder=_('Auto generated'))}
<label for='gistid'>${_('Gist id')}</label>
${h.text('gistid', placeholder=_('Auto generated'))}
<label for='lifetime'>${_('Gist lifetime')}</label>
${h.dropdownmenu('lifetime', '', c.lifetime_options)}
<label for='lifetime'>${_('Gist lifetime')}</label>
${h.dropdownmenu('lifetime', '', c.lifetime_options)}
<label for='acl_level'>${_('Gist access level')}</label>
${h.dropdownmenu('gist_acl_level', '', c.acl_options)}
<label for='acl_level'>${_('Gist access level')}</label>
${h.dropdownmenu('gist_acl_level', '', c.acl_options)}
<textarea style="margin-top: 5px" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
</div>
<div id="codeblock" class="codeblock">
<div class="code-header">
<div class="form">
<div class="fields">
${h.text('filename', size=30, placeholder=_('name this file...'))}
${h.text('filename', size=30, placeholder=_('name gist file...'))}
${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)}
</div>
</div>
</div>
<div id="editor_container">
<div id="editor_pre"></div>
<textarea id="editor" name="content" ></textarea>
</div>
</div>
<div class="pull-right">
${h.submit('private',_('Create Private Gist'),class_="btn")}
${h.submit('public',_('Create Public Gist'),class_="btn")}
${h.reset('reset',_('Reset'),class_="btn")}
</div>
${h.end_form()}
</div>