"Fossies" - the Fresh Open Source Software Archive

Member "redmine-4.1.1/app/views/timelog/_form.html.erb" (6 Apr 2020, 3187 Bytes) of package /linux/www/redmine-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) ERB Templates source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "_form.html.erb": 4.1.0_vs_4.1.1.

    1 <%= error_messages_for 'time_entry' %>
    2 <%= back_url_hidden_field_tag %>
    3 
    4 <div class="box tabular">
    5   <% if @time_entry.new_record? && params[:project_id] %>
    6     <%= hidden_field_tag 'project_id', params[:project_id] %>
    7   <% elsif @time_entry.new_record? && params[:issue_id] %>
    8     <%= hidden_field_tag 'issue_id', params[:issue_id] %>
    9   <% else %>
   10     <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).to_a, :selected => @time_entry.project, :include_blank => true), :required => true %></p>
   11   <% end %>
   12 
   13   <p>
   14     <%= f.text_field :issue_id, :size => 6, :required => Setting.timelog_required_fields.include?('issue_id') %>
   15     <span id="time_entry_issue">
   16       <%=  link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
   17     </span>
   18   </p>
   19 
   20   <% if User.current.allowed_to?(:log_time_for_other_users, @project) %>
   21     <p><%= f.select :user_id, user_collection_for_select_options(@time_entry), :required => true %></p>
   22   <% elsif !@time_entry.new_record? %>
   23     <p>
   24       <%= f.label_for_field :user_id %>
   25       <span><%= link_to_user(@time_entry.user) %></span>
   26     </p>
   27   <% end %>
   28   <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
   29   <p><%= f.hours_field :hours, :size => 6, :required => true %></p>
   30   <p><%= f.text_field :comments, :size => 100, :maxlength => 1024, :required => Setting.timelog_required_fields.include?('comments') %></p>
   31   <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
   32   <% @time_entry.editable_custom_field_values.each do |value| %>
   33     <p><%= custom_field_tag_with_label :time_entry, value %></p>
   34   <% end %>
   35   <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
   36 </div>
   37 
   38 <%= javascript_tag do %>
   39   $(document).ready(function(){
   40     $('#time_entry_project_id').change(function(){
   41       $('#time_entry_issue_id').val('');
   42     });
   43     $('#time_entry_project_id, #time_entry_issue_id').change(function(){
   44       $.ajax({
   45         url: '<%= escape_javascript(@time_entry.new_record? ? new_time_entry_path(:format => 'js') : edit_time_entry_path(:format => 'js')) %>',
   46         type: 'post',
   47         data: $(this).closest('form').serialize()
   48       });
   49     });
   50   });
   51 
   52   observeAutocompleteField('time_entry_issue_id',
   53     function(request, callback) {
   54       var url = '<%= j auto_complete_issues_path %>';
   55       var data = {
   56         term: request.term
   57       };
   58       var project_id;
   59       <% if @time_entry.new_record? && @project %>
   60       project_id = '<%= @project.id %>';
   61       <% else %>
   62       project_id = $('#time_entry_project_id').val();
   63       <% end %>
   64       if(project_id){
   65         data['project_id'] = project_id;
   66       } else {
   67         data['scope'] = 'all';
   68       }
   69 
   70       $.get(url, data, null, 'json')
   71         .done(function(data){
   72           callback(data);
   73         })
   74         .fail(function(jqXHR, status, error){
   75           callback([]);
   76         });
   77     },
   78     {
   79       select: function(event, ui) {
   80         $('#time_entry_issue').text('');
   81         $('#time_entry_issue_id').val(ui.item.value).change();
   82       }
   83     }
   84   );
   85 <% end %>