<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%
   js_bundle :eportfolio
%>
<% provide :page_title do %>
  <%= t(:page_title, "My ePortfolios") %>
<% end %>

<h1 class="screenreader-only"><%= t('headers.eportfolios', "ePortfolios") %></h1>
<% provide :right_side do %>
  <% if Eportfolio.new.grants_right?(@current_user, :create) %>
    <a href="#" class="add_eportfolio_link btn button-sidebar-wide">
      <i class="icon-add"></i>
      <%= t('links.create', "Create an ePortfolio") %>
    </a>
  <% end %>
<% end %>

<% if @portfolios.empty? %>
  <!-- when @portfolios.empty? then dont show the right hand side, it makes it look cleaner -->
  <style type="text/css">
    #sidebar{ display:none;}
  </style>
  <div id="whats_an_eportfolio">
  <h2><%= t('headers.what', "What's an ePortfolio?") %></h2>
  <%= mt('what.details1', <<-DETAILS)
ePortfolios are a place where you can display and discuss the significant
submissions and experiences that are happening during your learning
process. You can use an ePortfolio to:

* Display the papers you're proud of for more than just your instructor to see
* Talk about all the thought and work that went into your class submissions
* Gather an overview of your educational experience as a whole
* Share your work with friends, future employers, etc.

ePortfolios can be public for everyone to see, or private so only those you
allow can see, and you can change that setting at any time.

Ready to get started? Click the button.
DETAILS
  %>
  <div class="button-container">
    <a href="#" class="add_eportfolio_link btn button-sidebar-wide"><i class="icon-add"></i> <%= t('links.create', "Create an ePortfolio") %></a>
  </div>
  </div>
<% else %>
  <h2><%= t('headers.my_eportfolios', "My ePortfolios") %></h2>
  <ul class="unstyled_list" style="padding-<%= direction('left') %>: 20px;">
    <%= render :partial => "eportfolio", :collection => @portfolios %>
  </ul>
<% end %>
<%= form_for Eportfolio.new, :url => eportfolios_path, :html => {:style => "display: none;", :id => "add_eportfolio_form"} do |f| %>
<h2><%= t('headers.add_eportfolio', "Make an ePortfolio") %></h2>
<table class="formtable">
  <tr>
    <td><%= f.label :name, before_label(:eportfolio_name, "ePortfolio Name") %></td>
    <td><%= f.text_field :name, :value => t('defaults.eportfolio_name', "My Portfolio") %></td>
  </tr><tr>
    <td colspan="2">
      <%= f.check_box :public, :value => true %>
      <%= f.label :public, t('labels.make_public', "Make it Public"), :checked => true %>
    </td>
  </tr><tr>
    <td colspan="2">
      <button class="btn " id="eportfolio_submit" name="commit" type="submit"><%= t('buttons.add_eportfolio', "Make ePortfolio") %></button>
      <button type="button" class="cancel_button btn button-secondary" style><%= t('#buttons.cancel', "Cancel") %></button>
    </td>
  <td>
</table>
<% end %>
