Changeset - dff6d5cb8bba
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 15 years ago 2010-11-07 15:07:53
marcin@python-works.com
fixed deletion of repository on filesystem, works based on scm type for git and hg.
agged 'ago' into age function
some css fixes
5 files changed with 22 insertions and 19 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -91,13 +91,13 @@ class _ToolTip(object):
 
        YAHOO.util.Event.onDOMReady(function(){
 
            function toolTipsId(){
 
                var ids = [];
 
                var tts = YAHOO.util.Dom.getElementsByClassName('tooltip');
 
                
 
                for (var i = 0; i < tts.length; i++) {
 
                    //if element doesn not have and id autgenerate one for tooltip
 
                    //if element doesn't not have and id autgenerate one for tooltip
 
                    
 
                    if (!tts[i].id){
 
                        tts[i].id='tt'+i*100;
 
                    }
 
                    ids.push(tts[i].id);
 
                }
 
@@ -109,13 +109,13 @@ class _ToolTip(object):
 
                xyoffset :[0,0],
 
                autodismissdelay:300000,
 
                hidedelay:5,
 
                showdelay:20,
 
            });
 
            
 
            //Mouse Over event disabled for new repositories since they dont
 
            //Mouse Over event disabled for new repositories since they don't
 
            //have last commit message
 
            myToolTips.contextMouseOverEvent.subscribe(
 
                function(type, args) {
 
                    var context = args[0];
 
                    var txt = context.getAttribute('tooltip_title');
 
                    if(txt){                                       
 
@@ -344,15 +344,17 @@ def _age(curdate):
 
    age = datetime.now() - curdate
 
    age_seconds = (age.days * agescales[2][1]) + age.seconds
 
    pos = 1
 
    for scale in agescales:
 
        if scale[1] <= age_seconds:
 
            if pos == 6:pos = 5
 
            return time_ago_in_words(curdate, agescales[pos][0])
 
            return time_ago_in_words(curdate, agescales[pos][0]) + ' ' + _('ago')
 
        pos += 1
 

	
 
    return _('just now')
 

	
 
age = lambda  x:_age(x)
 
capitalize = lambda x: x.capitalize()
 
email = util.email
 
email_or_none = lambda x: util.email(x) if util.email(x) != x else None
 
person = lambda x: _person(x)
 
short_id = lambda x: x[:12]
rhodecode/model/repo.py
Show inline comments
 
@@ -161,14 +161,14 @@ class RepoModel(object):
 
        from rhodecode.lib.celerylib import tasks, run_task
 
        run_task(tasks.create_repo_fork, form_data, cur_user)
 

	
 
    def delete(self, repo):
 
        try:
 
            self.sa.delete(repo)
 
            self.__delete_repo(repo)
 
            self.sa.commit()
 
            self.__delete_repo(repo.repo_name)
 
        except:
 
            log.error(traceback.format_exc())
 
            self.sa.rollback()
 
            raise
 

	
 
    def delete_perm_user(self, form_data, repo_name):
 
@@ -197,14 +197,16 @@ class RepoModel(object):
 
        new_path = os.path.join(g.base_path, new)
 
        if os.path.isdir(new_path):
 
            raise Exception('Was trying to rename to already existing dir %s',
 
                            new_path)
 
        shutil.move(old_path, new_path)
 

	
 
    def __delete_repo(self, name):
 
        rm_path = os.path.join(g.base_path, name)
 
    def __delete_repo(self, repo):
 
        rm_path = os.path.join(g.base_path, repo.repo_name)
 
        log.info("Removing %s", rm_path)
 
        #disable hg 
 
        shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg'))
 
        #disable hg/git
 
        alias = repo.repo_type
 
        shutil.move(os.path.join(rm_path, '.%s' % alias),
 
                    os.path.join(rm_path, 'rm__.%s' % alias))
 
        #disable repo
 
        shutil.move(rm_path, os.path.join(g.base_path, 'rm__%s__%s' \
 
                                          % (datetime.today(), name)))
 
                                          % (datetime.today(), repo.repo_name)))
rhodecode/public/css/style.css
Show inline comments
 
@@ -256,13 +256,12 @@ padding:0;
 
background-position:0 -40px;
 
}
 
 
#header #header-inner #logo h1 {
 
color:#FFF;
 
font-size:14px;
 
text-transform:uppercase;
 
margin:13px 0 0 13px;
 
padding:0;
 
}
 
 
#header #header-inner #logo a {
 
color:#fff;
 
@@ -416,13 +415,13 @@ background:url("../images/icons/lock_ope
 
min-width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos,#header #header-inner #quick li ul li a.repos:hover {
 
background:url("../images/icons/folder_edit.png") no-repeat scroll 4px 9px #FFF;
 
background:url("../images/icons/database_edit.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover {
 
@@ -1390,13 +1389,12 @@ padding:0 !important;
 
 
.trending_language {
 
background-color:#003367;
 
color:#FFF;
 
display:block;
 
min-width:20px;
 
max-width:400px;
 
text-decoration:none;
 
height:12px;
 
margin-bottom:4px;
 
margin-left:5px;
 
white-space:pre;
 
padding:3px;
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -62,13 +62,13 @@
 
		             	%if node.is_file():
 
		             		<span class="tooltip" tooltip_title="${node.last_changeset.raw_id}">${node.last_changeset.revision}</span>
 
		             	%endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.date} - ${h.age(node.last_changeset.date)} ${_('ago')} 
 
		             		${node.last_changeset.date} - ${h.age(node.last_changeset.date)}
 
		             	%endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.author}
 
		             	%endif                    
rhodecode/templates/index.html
Show inline comments
 
@@ -51,15 +51,15 @@
 
			        <th class="left">${_('RSS')}</th>
 
			        <th class="left">${_('Atom')}</th>
 
	            </tr>
 
            </thead>
 
            <tbody>
 
		    %for cnt,repo in enumerate(c.repos_list):
 
		        %if h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(repo['name'],'main page check'):
 
		        <tr class="parity${cnt%2}">
 
		            <td>
 
		            <div style="white-space: nowrap">
 
		             ## TYPE OF REPO
 
		             %if repo['repo'].dbrepo.repo_type =='hg':
 
		               <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/>
 
		             %elif repo['repo'].dbrepo.repo_type =='git':
 
		               <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="/images/icons/giticon.png"/>
 
		             %else:
 
@@ -79,20 +79,22 @@
 
		            %if repo['repo'].dbrepo.fork:
 
		            	<a href="${h.url('summary_home',repo_name=repo['repo'].dbrepo.fork.repo_name)}">
 
		            	<img class="icon" alt="${_('fork')}"
 
		            	title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}" 
 
		            	src="/images/icons/arrow_divide.png"/></a>
 
		            %endif
 
		            </div>
 
		            </td>
 
		            ##DESCRIPTION
 
		            <td><span class="tooltip" tooltip_title="${repo['description']}">
 
		               ${h.truncate(repo['description'],60)}</span>
 
		            </td>
 
		            ##LAST CHANGE
 
		            <td>
 
		              <span>${repo['last_change']} - ${h.age(repo['last_change'])} </span>
 
		              <span class="tooltip" tooltip_title="${h.age(repo['last_change'])}">
 
		              ${repo['last_change']}</span>
 
		            </td>
 
		            <td>
 
		            	%if repo['rev']>=0:
 
		            	${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
 
		                h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
 
		                class_="tooltip",
 
@@ -106,13 +108,12 @@
 
		                <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
 
		            </td>        
 
		            <td>
 
		                <a title="${_('Subscribe to %s atom feed')%repo['name']}"  class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
 
		            </td>
 
		        </tr>
 
		        %endif
 
		    %endfor
 
            </tbody>
 
            </table>
 
            </div>
 
    </div>
 
    
 
@@ -133,26 +134,26 @@
 
     
 
     F.updateFilter  = function() { 
 
    	// Reset timeout 
 
        F.filterTimeout = null;
 
    	
 
        var obsolete = [];
 
        var nodes = S.query('div.table tr td a.repo_name');
 
        var nodes = S.query('div.table tr td div a.repo_name');
 
        var req = D.get('q_filter').value;
 
        for (n in nodes){
 
            D.setStyle(nodes[n].parentNode.parentNode,'display','')
 
            D.setStyle(nodes[n].parentNode.parentNode.parentNode,'display','')
 
        }
 
        if (req){
 
	        for (n in nodes){
 
	        	if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
 
	        		obsolete.push(nodes[n]); 
 
	        	}
 
	    	}
 
	        if(obsolete){
 
		        for (n in obsolete){
 
		        	D.setStyle(obsolete[n].parentNode.parentNode,'display','none');
 
		        	D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none');
 
		        }
 
	        }
 
        }
 
     }
 
     
 
     E.on(q_filter,'keyup',function(e){
0 comments (0 inline, 0 general)