Adds an add link to Social Media. closes #310

<%# header tag begins in parent template %>

      <img src="<%= Vutuv.Avatar.binary(@user, :medium) %>">

        <%= full_name(@user) %>
        <%= if same_user?(@user, @current_user) do %>
        <%= link to: user_path(@conn, :edit, @user), class: "profile-header__edit button button--icon button--small" do %>

        <% end %>
        <% end %>

        <%= current_title(@job) %>
        <%= if(@organization != "" and @organization) do %>
          @ <%= @organization %>
        <% end %>

        <%= if(@follower_count>0) do %>

<%= String.capitalize(@user.first_name) %> <%= gettext "has" %><%= @follower_count %> <%= gettext "followers" %>

        <% end %>
        <%= if is_visitor?(@conn, @current_user) do %>
          <%= if user_follows_user?(@current_user, @user) do %>
            <%= button to: connection_path(@conn, :delete, user_follows_user?(@current_user, @user)), method: :delete , class: "button button-link" do %>
               Unfollow
            <% end %>
          <%= else %>
            <%= button to: connection_path(@conn, :create, connection: %{follower_id: @current_user_id, followee_id: @user.id}), method: :post , class: "button button-link" do %>
               Follow
            <% end %>
          <% end %>
        <% end %>

<%= render Vutuv.LayoutView, "flash.html", assigns %>

  <%= gettext "Users" %> / <%= full_name @user %>

    <%= if same_user?(@user, @current_user) do %>
    <%= link to: user_path(@conn, :edit, @user), class: "card__edit button button--icon button--small" do %>

    <% end %>
    <% end %>

<%= gettext "Headline" %>

<%= @user.headline %>

      <%= if(@user.gender != "other" && @user.gender) do %>

<%= gettext "Gender" %>

<%= @user.gender %>

      <% end %>
      <%= if(@user.birthdate) do %>

<%= gettext "Birthday" %>

<%= @user.birthdate %>

      <% end %>

    <%= render Vutuv.SharedView, "_ad.html" %>

      <%= if same_user?(@user, @current_user) do %>
      <%= link to: user_email_path(@conn, :index, @user), class: "card__edit button button--icon button--small" do %>

      <% end %>
      <% end %>

<%= gettext "Contact" %>

<%= if (Enum.count(@emails) == 1), do: gettext("Email"), else: gettext("Emails") %>

        <%= for email <- @emails do %>

<a href="mailto:<%= email(@user) %>"><%= email.value %>

        <% end %>

<%= gettext "Vcard" %>

<%= link gettext("Download"), to: api_user_v_card_path(@conn, :get, @user) %>

      <%= if same_user?(@user, @current_user) do %>
      <%= link to: user_social_media_account_path(@conn, :index, @user), class: "card__edit button button--icon button--small" do %>

      <% end %>
      <% end %>

<%= gettext "Social Media" %>

        <%= for account <- @user.social_media_accounts do %>

<%= account.provider %>

<%= link "@#{account.value}", to: Vutuv.SocialMediaAccount.get_full_url(account) %>

        <% end %>

        <%= if same_user?(@user, @current_user) do %>
          <%= link gettext("Add"), to: user_social_media_account_path(@conn, :new, @current_user) %>
        <% end %>

  <%= if Enum.count(@user_skills) > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Skills" %>

    <%= if Enum.count(@user_skills) > 0 do %>
    <%= render Vutuv.UserSkillView, "card_list.html", assigns %>
    <% end %>

    <%= if same_user?(@user, @current_user) do %>
      <% #Form for easy skill entry %>
      <%= if Enum.count(@user_skills) == 0 do %>
        <%= form_for @conn, user_path(@conn, :skills_create, @user), [as: :skills, class: "editform"], fn f -> %>
          <div class="editform__field<%= if error_tag(f, :name), do: " editform__field--error"%>">
            <%= label f, :skills, gettext("Enter comma seperated skills here") %>
            <%= text_input f, :skills, placeholder: gettext("PHP, JavaScript, Tap Dancing, Origami"), autofocus: true %>
            <%= error_tag f, :skills %>

            <%= submit gettext("Add"), class: "button button--full" %>

        <% end %>
      <% end %>
    <% end %>
    <%= if Enum.count(@user_skills) > 0 do %>

        <%= if same_user?(@user, @current_user) do %>
          <%= link gettext("Add"), to: user_user_skill_path(@conn, :new, @current_user) %>
        <% end %>
        <%= if same_user?(@user, @current_user) and Enum.count(@user.user_skills) > 4 do %> | <% end %>
        <%= if Enum.count(@user.user_skills) > 4 do %>
          <%= link gettext("View All"), to: user_user_skill_path(@conn, :index, @user)%>
        <% end %>

    <% end %>

  <% end %>

  <section class="card half<%= if @follower_count == 0, do: " card--empty" %>">

<%= gettext "Followers" %>

    <%= if(@follower_count > 0) do %>

    <%= render "card_list.html", conn: @conn, users: @user.followers, current_user: @current_user, current_user_id: @current_user_id %>

    <% else %>

<%= gettext "No Followers yet!" %>

    <% end %>
    <%= if(@follower_count > 3) do %>
      <%= link "#{@followers_count-3} #{gettext "More"}", to: user_follower_path(@conn, :index, @user), class: "card__morelink" %>
    <% end %>

<%= gettext "Following" %>

    <%= if(@followee_count > 0) do %>

    <%= render "card_list.html", conn: @conn, users: @user.followees, current_user: @current_user, current_user_id: @current_user_id %>

    <% else %>

<%= gettext "Not following anyone yet!" %>

    <% end %>
    <%= if(@followee_count > 3) do %>
      <%= link "#{@followee_count-3} #{gettext "More"}", to: user_followee_path(@conn, :index, @user), class: "card__morelink" %>
    <% end %>

    <%= if @total_jobs > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Experience" %>

    <%= if @total_jobs > 0 do %>
    <%= render Vutuv.WorkExperienceView, "card_list.html", assigns %>

    <% else %>

    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_work_experience_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_jobs>3 do %> | <% end %>
      <%= if @total_jobs>3 do %>
        <%= link gettext("View All"), to: user_work_experience_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_numbers > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Phone Numbers" %>

    <%= if @total_numbers > 0 do %>
    <%= render Vutuv.PhoneNumberView, "card_list.html", phone_numbers: @user.phone_numbers, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_phone_number_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_numbers > 3 do %> | <% end %>
      <%= if @total_numbers>3 do %>
        <%= link gettext("View All"), to: user_phone_number_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_links > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Links" %>

    <%= if @total_links > 0 do %>
    <%= render Vutuv.UrlView, "card_list.html", urls: @user.urls, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_url_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_links > 3 do %> | <% end %>
      <%= if @total_links>3 do %>
        <%= link gettext("View All"), to: user_url_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_addresses > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Addresses" %>

    <%= if @total_addresses > 0 do %>
    <%= render Vutuv.AddressView, "card_list.html", addresses: @user.addresses, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_address_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_addresses > 3 do %> | <% end %>
      <%= if @total_addresses>3 do %>
        <%= link gettext("View All"), to: user_address_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

<%# header tag begins in parent template %>

      <img src="<%= Vutuv.Avatar.binary(@user, :medium) %>">

        <%= full_name(@user) %>
        <%= if same_user?(@user, @current_user) do %>
        <%= link to: user_path(@conn, :edit, @user), class: "profile-header__edit button button--icon button--small" do %>

        <% end %>
        <% end %>

        <%= current_title(@job) %>
        <%= if(@organization != "" and @organization) do %>
          @ <%= @organization %>
        <% end %>

        <%= if(@follower_count>0) do %>

<%= String.capitalize(@user.first_name) %> <%= gettext "has" %><%= @follower_count %> <%= gettext "followers" %>

        <% end %>
        <%= if is_visitor?(@conn, @current_user) do %>
          <%= if user_follows_user?(@current_user, @user) do %>
            <%= button to: connection_path(@conn, :delete, user_follows_user?(@current_user, @user)), method: :delete , class: "button button-link" do %>
               Unfollow
            <% end %>
          <%= else %>
            <%= button to: connection_path(@conn, :create, connection: %{follower_id: @current_user_id, followee_id: @user.id}), method: :post , class: "button button-link" do %>
               Follow
            <% end %>
          <% end %>
        <% end %>

<%= render Vutuv.LayoutView, "flash.html", assigns %>

  <%= gettext "Users" %> / <%= full_name @user %>

    <%= if same_user?(@user, @current_user) do %>
    <%= link to: user_path(@conn, :edit, @user), class: "card__edit button button--icon button--small" do %>

    <% end %>
    <% end %>

<%= gettext "Headline" %>

<%= @user.headline %>

      <%= if(@user.gender != "other" && @user.gender) do %>

<%= gettext "Gender" %>

<%= @user.gender %>

      <% end %>
      <%= if(@user.birthdate) do %>

<%= gettext "Birthday" %>

<%= @user.birthdate %>

      <% end %>

    <%= render Vutuv.SharedView, "_ad.html" %>

      <%= if same_user?(@user, @current_user) do %>
      <%= link to: user_email_path(@conn, :index, @user), class: "card__edit button button--icon button--small" do %>

      <% end %>
      <% end %>

<%= gettext "Contact" %>

<%= if (Enum.count(@emails) == 1), do: gettext("Email"), else: gettext("Emails") %>

        <%= for email <- @emails do %>

<a href="mailto:<%= email(@user) %>"><%= email.value %>

        <% end %>

<%= gettext "Vcard" %>

<%= link gettext("Download"), to: api_user_v_card_path(@conn, :get, @user) %>

      <%= if same_user?(@user, @current_user) do %>
      <%= link to: user_social_media_account_path(@conn, :index, @user), class: "card__edit button button--icon button--small" do %>

      <% end %>
      <% end %>

<%= gettext "Social Media" %>

        <%= for account <- @user.social_media_accounts do %>

<%= account.provider %>

<%= link "@#{account.value}", to: Vutuv.SocialMediaAccount.get_full_url(account) %>

        <% end %>

  <%= if Enum.count(@user_skills) > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Skills" %>

    <%= if Enum.count(@user_skills) > 0 do %>
    <%= render Vutuv.UserSkillView, "card_list.html", assigns %>
    <% end %>

    <%= if same_user?(@user, @current_user) do %>
      <% #Form for easy skill entry %>
      <%= if Enum.count(@user_skills) == 0 do %>
        <%= form_for @conn, user_path(@conn, :skills_create, @user), [as: :skills, class: "editform"], fn f -> %>
          <div class="editform__field<%= if error_tag(f, :name), do: " editform__field--error"%>">
            <%= label f, :skills, gettext("Enter comma seperated skills here") %>
            <%= text_input f, :skills, placeholder: gettext("PHP, JavaScript, Tap Dancing, Origami"), autofocus: true %>
            <%= error_tag f, :skills %>

            <%= submit gettext("Add"), class: "button button--full" %>

        <% end %>
      <% end %>
    <% end %>
    <%= if Enum.count(@user_skills) > 0 do %>

        <%= if same_user?(@user, @current_user) do %>
          <%= link gettext("Add"), to: user_user_skill_path(@conn, :new, @current_user) %>
        <% end %>
        <%= if same_user?(@user, @current_user) and Enum.count(@user.user_skills) > 4 do %> | <% end %>
        <%= if Enum.count(@user.user_skills) > 4 do %>
          <%= link gettext("View All"), to: user_user_skill_path(@conn, :index, @user)%>
        <% end %>

    <% end %>

  <% end %>

  <section class="card half<%= if @follower_count == 0, do: " card--empty" %>">

<%= gettext "Followers" %>

    <%= if(@follower_count > 0) do %>

    <%= render "card_list.html", conn: @conn, users: @user.followers, current_user: @current_user, current_user_id: @current_user_id %>

    <% else %>

<%= gettext "No Followers yet!" %>

    <% end %>
    <%= if(@follower_count > 3) do %>
      <%= link "#{@followers_count-3} #{gettext "More"}", to: user_follower_path(@conn, :index, @user), class: "card__morelink" %>
    <% end %>

<%= gettext "Following" %>

    <%= if(@followee_count > 0) do %>

    <%= render "card_list.html", conn: @conn, users: @user.followees, current_user: @current_user, current_user_id: @current_user_id %>

    <% else %>

<%= gettext "Not following anyone yet!" %>

    <% end %>
    <%= if(@followee_count > 3) do %>
      <%= link "#{@followee_count-3} #{gettext "More"}", to: user_followee_path(@conn, :index, @user), class: "card__morelink" %>
    <% end %>

    <%= if @total_jobs > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Experience" %>

    <%= if @total_jobs > 0 do %>
    <%= render Vutuv.WorkExperienceView, "card_list.html", assigns %>

    <% else %>

    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_work_experience_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_jobs>3 do %> | <% end %>
      <%= if @total_jobs>3 do %>
        <%= link gettext("View All"), to: user_work_experience_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_numbers > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Phone Numbers" %>

    <%= if @total_numbers > 0 do %>
    <%= render Vutuv.PhoneNumberView, "card_list.html", phone_numbers: @user.phone_numbers, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_phone_number_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_numbers > 3 do %> | <% end %>
      <%= if @total_numbers>3 do %>
        <%= link gettext("View All"), to: user_phone_number_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_links > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Links" %>

    <%= if @total_links > 0 do %>
    <%= render Vutuv.UrlView, "card_list.html", urls: @user.urls, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_url_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_links > 3 do %> | <% end %>
      <%= if @total_links>3 do %>
        <%= link gettext("View All"), to: user_url_path(@conn, :index, @user) %>
      <% end %>

  <% end %>

  <%= if @total_addresses > 0 or same_user?(@user, @current_user) do %>

<%= gettext "Addresses" %>

    <%= if @total_addresses > 0 do %>
    <%= render Vutuv.AddressView, "card_list.html", addresses: @user.addresses, user: @user, conn: @conn, current_user: @current_user %>
    <% end %>

      <%= if same_user?(@user, @current_user) do %>
        <%= link gettext("Add"), to: user_address_path(@conn, :new, @current_user) %>
      <% end %>
      <%= if same_user?(@user, @current_user) and @total_addresses > 3 do %> | <% end %>
      <%= if @total_addresses>3 do %>
        <%= link gettext("View All"), to: user_address_path(@conn, :index, @user) %>
      <% end %>

  <% end %>


Replace npmcdn.com with unpkg.com

Replace npmcdn.com with unpkg.com

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <%= if assigns[:ng2] do %>
      <base href="/chat/">
    <%= else %>
      <base href="/">
    <% end %>
    <title>Rongduan Zhu</title>
    <link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.6/angular-material.min.css">
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/style.css") %>">
  </head>
  <body>
    <%= render @view_module, @view_template, assigns %>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-animate.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-aria.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-messages.min.js"></script>
    <script src="//unpkg.com/@angular/router@0.2.0/angular1/angular_1_router.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.6/angular-material.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.6.1/lodash.min.js"></script>
    <script src="//cdn.rawgit.com/princemaple/scroll-trigger/v0.5.4/dist/scroll-trigger.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min.js"></script>
    <script src="//rawgit.com/angular/zone.js/master/dist/zone.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.3/Reflect.min.js"></script>
    <srcipt src="//unpkg.com/rxjs@5.0.0-beta.8/bundles/Rx.min.js"></srcipt>
    <script src="<%= static_path(@conn, "/js/app.js") %>"></script>
    <script src="<%= static_path(@conn, "/js/init.js")%>"></script>
    <%= if assigns[:ng2] do %>
      <script src="<%= static_path(@conn, "/js/ng2App.js") %>"></script>
    <% end %>
  </body>
</html>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <%= if assigns[:ng2] do %>
      <base href="/chat/">
    <%= else %>
      <base href="/">
    <% end %>
    <title>Rongduan Zhu</title>
    <link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.6/angular-material.min.css">
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/style.css") %>">
  </head>
  <body>
    <%= render @view_module, @view_template, assigns %>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-animate.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-aria.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-messages.min.js"></script>
    <script src="//npmcdn.com/@angular/router@0.2.0/angular1/angular_1_router.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.6/angular-material.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.6.1/lodash.min.js"></script>
    <script src="//cdn.rawgit.com/princemaple/scroll-trigger/v0.5.4/dist/scroll-trigger.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min.js"></script>
    <script src="//rawgit.com/angular/zone.js/master/dist/zone.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.3/Reflect.min.js"></script>
    <srcipt src="//npmcdn.com/rxjs@5.0.0-beta.8/bundles/Rx.min.js"></srcipt>
    <script src="<%= static_path(@conn, "/js/app.js") %>"></script>
    <script src="<%= static_path(@conn, "/js/init.js")%>"></script>
    <%= if assigns[:ng2] do %>
      <script src="<%= static_path(@conn, "/js/ng2App.js") %>"></script>
    <% end %>
  </body>
</html>


Style retro create form + button

Style retro create form + button

<%= form_for @conn, retro_path(@conn, :create), [as: :retro, class: "ui form"], fn _f -> %>
  <%= submit "Create a Retrospective", class: "ui button teal" %>
<% end %>

<%= form_for @conn, retro_path(@conn, :create), [as: :retro], fn _f -> %>
  <%= submit "Create a Retrospective" %>
<% end %>


Add link to source code

Add link to source code

<!DOCTYPE html>
<html lang="<%= locale %>">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Play memory/concentration game with friends over the Internet without registration">
    <meta name="author" content="Max Gorin">
    <meta content='/images/landing.jpg' property='og:image'>

    <title>Play PairsOne/Concentration game over the Internet</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

      <%= if assigns[:mini_header] do %>

            <%= link to: "/" do %>

              Pairs One
            <% end %>

          <%= if assigns[:show_new_link] do %>

              <%= link gettext("New game"), to: game_path(@conn, :new), class: "btn btn-default" %>

          <% end %>

      <% else %>

            <%= link to: "/" do %>

              Pairs One
            <% end %>

 <%= gettext "Best multiplayer online memory game" %>

      <% end %>

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

          <%= render @view_module, @view_template, assigns %>

          <select name="language" id="language" onchange="">
            <%= for {code, name} <- lang_select_options do %>
              <option value="<%= code %>" <%= if locale == code do "selected" end %>><%= name %></option>
            <% end %>
          </select>

          © <%= DateTime.utc_now.year %>
          <%= link "Max Gorin", to: "https://twitter.com/mxgrn" %>

            <%= gettext "Hire me" %>

          <%= link to: "https://github.com/mxgrn/pairs.one" do %>

            <%= gettext "Source code" %>
          <% end %>

    <%= unless @conn.host == "localhost" do %>
      <%= render "ga.html" %>
    <% end %>

<!DOCTYPE html>
<html lang="<%= locale %>">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Play memory/concentration game with friends over the Internet without registration">
    <meta name="author" content="Max Gorin">
    <meta content='/images/landing.jpg' property='og:image'>

    <title>Play PairsOne/Concentration game over the Internet</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

      <%= if assigns[:mini_header] do %>

            <%= link to: "/" do %>

              Pairs One
            <% end %>

          <%= if assigns[:show_new_link] do %>

              <%= link gettext("New game"), to: game_path(@conn, :new), class: "btn btn-default" %>

          <% end %>

      <% else %>

            <%= link to: "/" do %>

              Pairs One
            <% end %>

 <%= gettext "Best multiplayer online memory game" %>

      <% end %>

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

          <%= render @view_module, @view_template, assigns %>

          <select name="language" id="language" onchange="">
            <%= for {code, name} <- lang_select_options do %>
              <option value="<%= code %>" <%= if locale == code do "selected" end %>><%= name %></option>
            <% end %>
          </select>

          © <%= DateTime.utc_now.year %>
          <%= link "Max Gorin", to: "https://twitter.com/mxgrn" %>

            <%= gettext "Hire me" %>

          <%= link to: "https://twitter.com/playpairs" do %>

            <%= gettext "Updates" %>
          <% end %>

    <%= unless @conn.host == "localhost" do %>
      <%= render "ga.html" %>
    <% end %>


Display latest app version on footer

Display latest app version on footer

    <meta charset="utf-8">
    <meta content="IE=Edge chrome=1" http-equiv="X-UA-Compatible">
    <meta content="width=device-width initial-scale=1.0" name="viewport">
    <title>Discuss-It</title>

    <meta content="Discuss It - Online discussion tracker for finding conversations" name="description">
    <meta content="lucas charles" name="author">
    <meta content="index" name="robots">
    <meta content="website discussions reddit slashdot hackernews conversations search" name="keywords">
    <meta content="Discuss It" property="og:title">
    <meta content="Website" property="og:type">
    <meta content="http://discussitapp.com" property="og:url">
    <meta content="Discuss It App" property="og:site_name">
    <meta content="Discuss It - Online discussion tracker for finding conversations" property="og:description">

    <meta content="width=device-width initial-scale=1" name="viewport">

    <link rel="stylesheet" href="/css/app.css">

    <meta content="kMG6lgDLRhhYRIaPnIyu-Zu-Ll8O463w9V6cvzPTDZ4" name="google-site-verification">

          <button class="navbar-toggle collapsed" aria-expanded="false" data-target="#navbar-collapsable-1" data-toggle="collapse" type="button">
            Toggle navigation

          </button>
          Discuss It!

              About

          <%= render @view_module, @view_template, assigns %>

Discuss It 2016 - v<%= @app_version %>

    <meta charset="utf-8">
    <meta content="IE=Edge chrome=1" http-equiv="X-UA-Compatible">
    <meta content="width=device-width initial-scale=1.0" name="viewport">
    <title>Discuss-It</title>

    <meta content="Discuss It - Online discussion tracker for finding conversations" name="description">
    <meta content="lucas charles" name="author">
    <meta content="index" name="robots">
    <meta content="website discussions reddit slashdot hackernews conversations search" name="keywords">
    <meta content="Discuss It" property="og:title">
    <meta content="Website" property="og:type">
    <meta content="http://discussitapp.com" property="og:url">
    <meta content="Discuss It App" property="og:site_name">
    <meta content="Discuss It - Online discussion tracker for finding conversations" property="og:description">

    <meta content="width=device-width initial-scale=1" name="viewport">

    <link rel="stylesheet" href="/css/app.css">

    <meta content="kMG6lgDLRhhYRIaPnIyu-Zu-Ll8O463w9V6cvzPTDZ4" name="google-site-verification">

          <button class="navbar-toggle collapsed" aria-expanded="false" data-target="#navbar-collapsable-1" data-toggle="collapse" type="button">
            Toggle navigation

          </button>
          Discuss It!

              About

          <%= render @view_module, @view_template, assigns %>

Discuss It 2016 - v0.8.0


fix: use correct links to sub pages

fix: use correct links to sub pages

<img src="<%= static_path(@conn, "/images/christian-kruse.jpg") %>" alt="Christian Kruse" class="big">

    Welcome. On this page you can find my
    <%= link "software projects", to: page_path(@conn, :software) %>,
    my <%= link "articles", to: article_path(@conn, :index) %>,
    my <%= link "notes", to: note_path(@conn, :index) %> and my
    <%= link "pictures", to: picture_path(@conn, :index) %>.

    My name is Christian Kruse. I work as a software developer and
    system administator at <%= link "Termitel GmbH", to: "https://termitel.de/" %>.
    I live in Germany in a small town called
    <%= link "Steinfurt", to: "https://en.wikipedia.org/wiki/Steinfurt" %>.

    I am passionate about software development,
    <%= link "Linux", to: "https://en.wikipedia.org/wiki/Linux" %>,
    <%= link "FLOSS", to: "https://en.wikipedia.org/wiki/Free_and_open-source_software" %>
    as well as <%= link "OS X", to: "https://en.wikipedia.org/wiki/OS_X" %>.
    I am also a do-it-yourself apologetic: I did a lot of things in and
    around my house myself. I love the hacker culture. And last but not
    least I am a dog owner.

    This is my personal replacement for Twitter, Facebook and the other
    data silos. <%= link "My content is mine", to: "http://indiewebcamp.com/" %>
    — so if you are interested in my activity, just have a look at this
    page.

<%= if assigns[:article] do %>

Last Article

    <%= render(Wwwtech.ArticleView, "article.html",
               article: @article, home: true, conn: @conn,
               index: true) %>

<% end %>

<%= unless Enum.empty?(@days) do %>

<%= link to: page_path(@conn, :index) <> "whatsnew.atom" do %><img src="<%= static_path(@conn, "/images/atom-feed-icon.gif") %>" alt="Atom Feed"><% end %>

What's new

    <%= for this_day <- @days do %>
      <%= for item <- @entries_by_day[this_day] do %>

            <%= if item == List.first(@entries_by_day[this_day]) do %>

                <%= cond do %>
                <% item |> Wwwtech.Note.today? -> %>
                  Today
                <% item |> Wwwtech.Note.yesterday? -> %>
                  Yesterday
                <% true -> %>
                  <%= item |> Wwwtech.Note.created_at_timex |> DateFormat.format!("%Y-%m-%d", :strftime) %>
                <% end %>

            <% end %>

            <%= cond do %>
              <% item.__struct__ == Wwwtech.Picture -> %><%= render(Wwwtech.PictureView, "picture.html", picture: item, conn: @conn, home: true, index: true) %>
            <% item.__struct__ == Wwwtech.Note -> %><%= render(Wwwtech.NoteView, "note.html", note: item, conn: @conn, home: true, index: true) %>
              <% true -> %>
            <%= end %>

      <% end %>
    <% end %>

<% end %>

<img src="<%= static_path(@conn, "/images/christian-kruse.jpg") %>" alt="Christian Kruse" class="big">

    Welcome. On this page you can find my
    <%= link "software projects", to: page_path(@conn, :software) %>,
    my <%= link "articles", to: "" %>,
    my <%= link "notes", to: "" %> and my
    <%= link "pictures", to: "" %>.

    My name is Christian Kruse. I work as a software developer and
    system administator at <%= link "Termitel GmbH", to: "https://termitel.de/" %>.
    I live in Germany in a small town called
    <%= link "Steinfurt", to: "https://en.wikipedia.org/wiki/Steinfurt" %>.

    I am passionate about software development,
    <%= link "Linux", to: "https://en.wikipedia.org/wiki/Linux" %>,
    <%= link "FLOSS", to: "https://en.wikipedia.org/wiki/Free_and_open-source_software" %>
    as well as <%= link "OS X", to: "https://en.wikipedia.org/wiki/OS_X" %>.
    I am also a do-it-yourself apologetic: I did a lot of things in and
    around my house myself. I love the hacker culture. And last but not
    least I am a dog owner.

    This is my personal replacement for Twitter, Facebook and the other
    data silos. <%= link "My content is mine", to: "http://indiewebcamp.com/" %>
    — so if you are interested in my activity, just have a look at this
    page.

<%= if assigns[:article] do %>

Last Article

    <%= render(Wwwtech.ArticleView, "article.html",
               article: @article, home: true, conn: @conn,
               index: true) %>

<% end %>

<%= unless Enum.empty?(@days) do %>

<%= link to: page_path(@conn, :index) <> "whatsnew.atom" do %><img src="<%= static_path(@conn, "/images/atom-feed-icon.gif") %>" alt="Atom Feed"><% end %>

What's new

    <%= for this_day <- @days do %>
      <%= for item <- @entries_by_day[this_day] do %>

            <%= if item == List.first(@entries_by_day[this_day]) do %>

                <%= cond do %>
                <% item |> Wwwtech.Note.today? -> %>
                  Today
                <% item |> Wwwtech.Note.yesterday? -> %>
                  Yesterday
                <% true -> %>
                  <%= item |> Wwwtech.Note.created_at_timex |> DateFormat.format!("%Y-%m-%d", :strftime) %>
                <% end %>

            <% end %>

            <%= cond do %>
              <% item.__struct__ == Wwwtech.Picture -> %><%= render(Wwwtech.PictureView, "picture.html", picture: item, conn: @conn, home: true, index: true) %>
            <% item.__struct__ == Wwwtech.Note -> %><%= render(Wwwtech.NoteView, "note.html", note: item, conn: @conn, home: true, index: true) %>
              <% true -> %>
            <%= end %>

      <% end %>
    <% end %>

<% end %>


Add example panels to home page

Add example panels to home page

<%= title() %>

  <%= gettext("The website for “Jugend musiziert” at German schools abroad") %>

    <%= host_map_image() %>

Beispiel eins

        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Beispiel zwei

         Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.


Adds select field for gender.

Adds select field for gender.

<%= form_for @changeset, @action, [multipart: true], fn f -> %>
  <%= if @changeset.action do %>

<%= gettext "Oops, something went wrong! Please check the errors below." %>

  <% end %>

    <%= label f, :gender, class: "control-label" %>
    <%= select f, :gender, [{gettext("Mr"), "male"},
      {gettext("Mrs"), "female"}, {gettext("Other"), "other"}], class: "form-control" %>
    <%= error_tag f, :gender %>

    <%= label f, :first_name, class: "control-label" %>
    <%= text_input f, :first_name, class: "form-control" %>
    <%= error_tag f, :first_name %>

    <%= label f, :last_name, class: "control-label" %>
    <%= text_input f, :last_name, class: "form-control" %>
    <%= error_tag f, :last_name %>

    <%= label f, :middlename, class: "control-label" %>
    <%= text_input f, :middlename, class: "form-control" %>
    <%= error_tag f, :middlename %>

    <%= label f, :nickname, class: "control-label" %>
    <%= text_input f, :nickname, class: "form-control" %>
    <%= error_tag f, :nickname %>

    <%= label f, :honorific_prefix, class: "control-label" %>
    <%= text_input f, :honorific_prefix, class: "form-control" %>
    <%= error_tag f, :honorific_prefix %>

    <%= label f, :honorific_suffix, class: "control-label" %>
    <%= text_input f, :honorific_suffix, class: "form-control" %>
    <%= error_tag f, :honorific_suffix %>

    <%= label f, :birthdate, class: "control-label" %>
    <%= date_select f, :birthdate, class: "form-control" %>
    <%= error_tag f, :birthdate %>

    <%= label f, :avatar, class: "control-label" %>
    <%= file_input f, :avatar, class: "form-control" %>

    <%= submit gettext("Submit"), class: "btn btn-primary" %>

<% end %>

<%= form_for @changeset, @action, [multipart: true], fn f -> %>
  <%= if @changeset.action do %>

<%= gettext "Oops, something went wrong! Please check the errors below." %>

  <% end %>

    <%= label f, :first_name, class: "control-label" %>
    <%= text_input f, :first_name, class: "form-control" %>
    <%= error_tag f, :first_name %>

    <%= label f, :last_name, class: "control-label" %>
    <%= text_input f, :last_name, class: "form-control" %>
    <%= error_tag f, :last_name %>

    <%= label f, :middlename, class: "control-label" %>
    <%= text_input f, :middlename, class: "form-control" %>
    <%= error_tag f, :middlename %>

    <%= label f, :nickname, class: "control-label" %>
    <%= text_input f, :nickname, class: "form-control" %>
    <%= error_tag f, :nickname %>

    <%= label f, :honorific_prefix, class: "control-label" %>
    <%= text_input f, :honorific_prefix, class: "form-control" %>
    <%= error_tag f, :honorific_prefix %>

    <%= label f, :honorific_suffix, class: "control-label" %>
    <%= text_input f, :honorific_suffix, class: "form-control" %>
    <%= error_tag f, :honorific_suffix %>

    <%= label f, :gender, class: "control-label" %>
    <%= text_input f, :gender, class: "form-control" %>
    <%= error_tag f, :gender %>

    <%= label f, :birthdate, class: "control-label" %>
    <%= date_select f, :birthdate, class: "form-control" %>
    <%= error_tag f, :birthdate %>

    <%= label f, :verified, class: "control-label" %>
    <%= checkbox f, :verified, class: "form-control" %>
    <%= error_tag f, :verified %>

    <%= label f, :avatar, class: "control-label" %>
    <%= file_input f, :avatar, class: "form-control" %>

    <%= submit gettext("Submit"), class: "btn btn-primary" %>

<% end %>


Fix detection of ERTS_VSN if include_erts is a binary

#!/bin/sh

set -e

# Set VERBOSE to enable verbose logging of the boot script
#VERBOSE=true
if [ ! -z $DEBUG_BOOT ]; then
    set -x
fi;

my_readlink_f() {
    TARGET_FILE="$1"
    cd $(dirname "$TARGET_FILE")
    TARGET_FILE=$(basename "$TARGET_FILE")

    # Iterate down a (possible) chain of symlinks
    while [ -L "$TARGET_FILE" ]
    do
        TARGET_FILE=$(readlink "$TARGET_FILE")
        cd $(dirname "$TARGET_FILE")
        TARGET_FILE=$(basename "$TARGET_FILE")
    done
    # Compute the canonicalized name by finding the physical path
    # for the directory we're in and appending the target file.
    PHYS_DIR=$(pwd -P)
    RESULT="$PHYS_DIR/$TARGET_FILE"
    echo "$RESULT"
}

# Path to this script
if uname | grep -q 'Darwin'; then
  # on OSX, best to install coreutils from homebrew or similar
  # to get greadlink
  if command -v greadlink >/dev/null 2>&1; then
    SCRIPT=$(greadlink -f "$0")
  else
    SCRIPT=$(my_readlink_f "$0" )
  fi
else
  SCRIPT=$(readlink -f "$0" )
fi

# Parent directory of this script
SCRIPT_DIR=$(dirname "${SCRIPT}")
# Root directory of all releases
RELEASE_ROOT_DIR=$(dirname $(dirname ${SCRIPT_DIR}))

# Disable flow control for run_erl
# Flow control can cause several problems. On Linux, if you
# accidentally hit Ctrl-S (instead of Ctrl-D to detach) and
# then some other key, the entire beam process will hang when
# attempting to write to stdout. On Solaris, the beam process
# will hang on writing if ScrollLock is on.
RUN_ERL_DISABLE_FLOWCNTRL="${RUN_ERL_DISABLE_FLOWCNTRL:-true}"
# Name of the release
REL_NAME="<%= release_name %>"
# Current version of the release
REL_VSN="<%= release_version %>"
# Current version of ERTS being used
# If this is not present/unset, it will be detected
<%= if ((is_binary(include_erts) or include_erts) and not is_nil(erts_vsn)) do %>ERTS_VSN="<%= erts_vsn %>"<% end %>
# VM code loading mode, embedded by default, can also be interactive
# See http://erlang.org/doc/man/code.html
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
# Path to start_erl.data
START_ERL_DATA="$RELEASE_ROOT_DIR/releases/start_erl.data"
# Directory containing the current version of this release
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
# The lib directory for this release
REL_LIB_DIR="$RELEASE_ROOT_DIR/lib"
# Options passed to erl
ERL_OPTS="<%= release.profile.erl_opts %>"
# When stdout is piped to a file, this is the directory those files will
# be stored in. defaults to /log in the release root directory

# RELEASE_MUTABLE_DIR
RELEASE_MUTABLE_DIR="${RELEASE_MUTABLE_DIR:-$RELEASE_ROOT_DIR/var}"

RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_MUTABLE_DIR/log}"
# A string of extra options to pass to erl, here for plugins
EXTRA_OPTS=""

# Pre-start/stop event hook paths
PRE_START_HOOKS="$REL_DIR/hooks/pre_start.d"
POST_START_HOOKS="$REL_DIR/hooks/post_start.d"
PRE_STOP_HOOKS="$REL_DIR/hooks/pre_stop.d"
POST_STOP_HOOKS="$REL_DIR/hooks/post_stop.d"
PRE_UPGRADE_HOOKS="$REL_DIR/hooks/pre_upgrade.d"
POST_UPGRADE_HOOKS="$REL_DIR/hooks/post_upgrade.d"

# Get node pid
get_pid() {
    if output="$(nodetool rpcterms os getpid)"
    then
        echo "$output" | sed -e 's/"//g'
        return 0
    else
        echo "$output"
        return 1
    fi
}

# Generate a unique nodename
gen_nodename() {
    id="longname$(gen_id)-${NAME}"
    "$BINDIR/erl" -boot start_clean -eval '[Host] = tl(string:tokens(atom_to_list(node()),"@")), io:format("~s~n", [Host]), halt()' -noshell ${NAME_TYPE} $id
}

# Generate a random id
gen_id() {
    od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
}

# Control a node
# Use like `nodetool "ping"`
nodetool() {
    command="$1"; shift

    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
                            -setcookie "$COOKIE" "$command" $@
}

# Run an escript in the node's environment
# Use like `escript "path/to/escript"`
escript() {
    shift; scriptpath="$1"; shift
    export RELEASE_ROOT_DIR

    "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}

# Private. Load target cookie, either from vm.args or $HOME/.cookie
_load_cookie() {
    COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
    DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
    if [ -z "$COOKIE_ARG" ]; then
        if [ -f "$DEFAULT_COOKIE_FILE" ]; then
            COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
        fi
    else
        # Extract cookie name from COOKIE_ARG
        COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
    fi
}

# Private. Ensure that cookie is set.
_check_cookie() {
    # Attempt reloading cookie in case it has been set in a hook
    if [ -z "$COOKIE" ]; then
        _load_cookie
    fi
    # Die if cookie is still not set, as connecting via distribution will fail
    if [ -z "$COOKIE" ]; then
        printf "a secret cookie must be provided in one of the following ways:\n  - with vm.args using the -setcookie parameter,\n  or\n  by writing the cookie to '$DEFAULT_COOKIE_FILE', with permissions set to 0400"
        exit 1
    fi
}

# Private. For determining the version of ERTS available to the release
# This is only ever called if ERTS_VSN is not set
_detect_erts_vsn() {
    set +e # temporarily disable so we can display a nice error message to the user
    __erl="$(which erl)"
    set -e
    if [ -z "${__erl}"  ]; then
        echo 'erlang runtime not found. If erlang is installed check your $PATH. aborting.'
        exit 1
    fi
    "$__erl" -boot start_clean -eval 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' -noshell
}

# Private. Gets a list of code paths for this release
_get_code_paths() {
    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/release_utils.escript" "get_code_paths" "$ROOTDIR" "$ERTS_DIR" "$REL_NAME" "$REL_VSN"
}

# Private. For setting ERTS_DIR and ROOTDIR
_find_erts_dir() {
    __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN"
    if [ -d "$__erts_dir" ]; then
        ERTS_DIR="$__erts_dir";
        ROOTDIR="$RELEASE_ROOT_DIR"
    else
        set +e # temporarily disable so we can display a nice error message to the user
        __erl="$(which erl)"
        set -e
        if [ -z "${__erl}"  ]; then
          echo 'erlang runtime not found. If erlang is installed check your $PATH. aborting.'
          exit 1
        fi
        code="io:format(\"~s\", [code:root_dir()]), halt()."
        __erl_root="$("$__erl" -noshell -eval "$code")"
        ERTS_DIR="$__erl_root/erts-$ERTS_VSN"
        ROOTDIR="$__erl_root"
    fi
}

# Private. Open a shell on a remote node
_rem_sh() {
    # Generate a unique id used to allow multiple remsh to the same node
    # transparently
    id="remsh$(gen_id)-${NAME}"

    # Get the node's ticktime so that we use the same thing.
    TICKTIME="$(nodetool rpcterms net_kernel get_net_ticktime)"

    # Setup remote shell command to control node
    if [ ! -z "$USE_ERL_SHELL" ]; then
        exec "$BINDIR/erl" \
            -hidden \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            "$NAME_TYPE" "$id" -remsh "$NAME" -setcookie "$COOKIE"
    else
        __code_paths=$(_get_code_paths)
        exec "$BINDIR/erl" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -hidden -noshell \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            -user Elixir.IEx.CLI "$NAME_TYPE" "$id" -setcookie "$COOKIE" \
            -extra --no-halt +iex -"$NAME_TYPE" "$id" --cookie "$COOKIE" --remsh "$NAME"
    fi
}

# Output a start command for the last argument of run_erl
_start_command() {
    printf "exec \"%s\" \"%s\" -- %s %s" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \
           "$START_OPTION" "${ARGS}" "${EXTRA_OPTS}"
}

# Do a textual replacement of ${VAR} occurances in $1 and pipe to $2
_replace_os_vars() {
    awk '
        function escape(s) {
            gsub(/'\&'/, "\\\\&", s);
            return s;
        }
        {
            while(match($0,"[$]{[^}]*}")) {
                var=substr($0,RSTART+2,RLENGTH-3);
                gsub("[$]{"var"}", escape(ENVIRON[var]))
            }
        }1' < "$1" > "$1.bak"
    mv -- "$1.bak" "$1"
}

# Private. Run hooks from directory.
_run_hooks_from_dir() {
   if [ -d "$1" ]; then
      for file in $1/[0-9a-zA-Z]*.sh; do
        [ -f "$file" ] || continue
        . "$file"
      done
   fi
}

# If TERM is not set, set it to xterm
if [ -z "$TERM" ]; then
    export TERM=xterm
fi

# If ERTS_VSN is not set, detect it
if [ -z "$ERTS_VSN" ]; then
    ERTS_VSN="$(_detect_erts_vsn)"
    echo "$ERTS_VSN $REL_VSN" > "$START_ERL_DATA"
fi

# Allow override of where to read configuration from
# By default it's RELEASE_ROOT_DIR
if [ -z "$RELEASE_CONFIG_DIR" ]; then
    RELEASE_CONFIG_DIR="$RELEASE_ROOT_DIR"
fi

# Make sure directories exist
mkdir -p "$RELEASE_MUTABLE_DIR"
echo "Files in this directory are regenerated frequently, edits will be lost" \
    > "$RELEASE_MUTABLE_DIR/WARNING_README"
mkdir -p "$RUNNER_LOG_DIR"

# Set VMARGS_PATH, the path to the vm.args file to use
# Use $RELEASE_CONFIG_DIR/vm.args if exists, otherwise releases/VSN/vm.args
if [ -z "$VMARGS_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/vm.args" ]; then
        VMARGS_PATH="$RELEASE_CONFIG_DIR/vm.args"
    else
        VMARGS_PATH="$REL_DIR/vm.args"
    fi
fi
if [ "$VMARGS_PATH" != "$RELEASE_MUTABLE_DIR/vm.args" ]; then
    echo "#### Generated - edit/create $RELEASE_CONFIG_DIR/vm.args instead." \
        >  "$RELEASE_MUTABLE_DIR/vm.args"
    cat  "$VMARGS_PATH"                              \
        >> "$RELEASE_MUTABLE_DIR/vm.args"
    VMARGS_PATH=$RELEASE_MUTABLE_DIR/vm.args
fi
if [ $REPLACE_OS_VARS ]; then
    _replace_os_vars "$VMARGS_PATH"
fi

# Set SYS_CONFIG_PATH, the path to the sys.config file to use
# Use $RELEASE_CONFIG_DIR/sys.config if exists, otherwise releases/VSN/sys.config
if [ -z "$SYS_CONFIG_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/sys.config" ]; then
        SYS_CONFIG_PATH="$RELEASE_CONFIG_DIR/sys.config"
    else
        SYS_CONFIG_PATH="$REL_DIR/sys.config"
    fi
fi
if [ "$SYS_CONFIG_PATH" != "$RELEASE_MUTABLE_DIR/sys.config" ]; then
    echo "%% Generated - edit/create $RELEASE_CONFIG_DIR/sys.config instead." \
        >  "$RELEASE_MUTABLE_DIR/sys.config"
    cat  "$SYS_CONFIG_PATH"                              \
        >> "$RELEASE_MUTABLE_DIR/sys.config"
    SYS_CONFIG_PATH=$RELEASE_MUTABLE_DIR/sys.config
fi
if [ $REPLACE_OS_VARS ]; then
    _replace_os_vars "$SYS_CONFIG_PATH"
fi

# Extract the target node name from node.args
# Should be `-sname somename` or `-name somename@somehost`
NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH" || true)
if [ -z "$NAME_ARG" ]; then
    echo "vm.args needs to have either -name or -sname parameter."
    exit 1
fi

# Extract the name type and name from the NAME_ARG for REMSH
# NAME_TYPE should be -name or -sname
NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')"
# NAME will be either `somename` or `somename@somehost`
NAME="$(echo "$NAME_ARG" | awk '{print $2}')"

# Where the pipe will be stored when using `start`
# This is used so you can attach the running application to the current
# shell using `attach`
PIPE_DIR="${PIPE_DIR:-$RELEASE_MUTABLE_DIR/erl_pipes/$NAME/}"

# Extract the target cookie
_load_cookie

_find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"
export EMU="beam"
export PROGNAME="erl"
export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
ERTS_LIB_DIR="$ERTS_DIR/../lib"
CONSOLIDATED_DIR="$ROOTDIR/lib/${REL_NAME}-${REL_VSN}/consolidated"

cd "$ROOTDIR"

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
    *@*)
        # Nothing to do
        ;;
    *)
        NAME=$NAME@$(gen_nodename)
        ;;
esac

# Check the first argument for instructions
case "$1" in
    start|start_boot)

        # Make sure there is not already a node running
        #RES=`$NODETOOL ping`
        #if [ "$RES" = "pong" ]; then
        #    echo "Node is already running!"
        #    exit 1
        #fi
        # Save this for later.
        CMD=$1
        case "$1" in
            start)
                shift
                START_OPTION="console"
                HEART_OPTION="start"
                ;;
            start_boot)
                shift
                START_OPTION="console_boot"
                HEART_OPTION="start_boot"
                ;;
        esac
        ARGS="$@"
        RUN_PARAM="$@"

        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Set arguments for the heart command
        set -- "$SCRIPT_DIR/$REL_NAME" "$HEART_OPTION"
        [ "$RUN_PARAM" ] && set -- "$@" "$RUN_PARAM"

        # Export the HEART_COMMAND
        HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $CMD"
        export HEART_COMMAND

        mkdir -p "$PIPE_DIR"

        "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
                          "$(_start_command)"

        _run_hooks_from_dir "$POST_START_HOOKS"
        ;;

    stop)
        _check_cookie
        _run_hooks_from_dir "$PRE_STOP_HOOKS"
        # Wait for the node to completely stop...
        PID="$(get_pid)"
        if ! nodetool "stop"; then
            exit 1
        fi
        while $(kill -s 0 "$PID" 2>/dev/null);
        do
            sleep 1
        done
        _run_hooks_from_dir "$POST_STOP_HOOKS"
        ;;

    restart)
        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"
        ## Restart the VM without exiting the process
        if ! nodetool "restart"; then
            exit 1
        fi
        ;;

    reboot)
        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"
        ## Restart the VM completely (uses heart to restart it)
        if ! nodetool "reboot"; then
            exit 1
        fi
        ;;

    pid)
        ## Get the VM's pid
        _check_cookie
        if ! get_pid; then
            exit 1
        fi
        ;;

    ping)
        _check_cookie
        ## See if the VM is alive
        if ! nodetool "ping"; then
            exit 1
        fi
        ;;

    escript)
        _check_cookie
        ## Run an escript under the node's environment
        if ! escript $@; then
            exit 1
        fi
        ;;

    attach)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        exec "$BINDIR/to_erl" "$PIPE_DIR"
        ;;

    remote_console)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        _rem_sh
        ;;

    upgrade|downgrade|install)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        SOURCE_VERSION="$REL_VSN"
        TARGET_VERSION="$2"

        "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "unpack_release" "$REL_NAME" "$NAME_TYPE"  "$NAME" "$COOKIE" "$TARGET_VERSION"

        _run_hooks_from_dir "$PRE_UPGRADE_HOOKS"

        "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "install_release" "$REL_NAME" "$NAME_TYPE"  "$NAME" "$COOKIE" "$TARGET_VERSION"

        _run_hooks_from_dir "$POST_UPGRADE_HOOKS"

        ;;
    unpack)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "unpack_release" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    console|console_clean|console_boot)
        # .boot file typically just $REL_NAME (ie, the app name)
        # however, for debugging, sometimes start_clean.boot is useful.
        # For e.g. 'setup', one may even want to name another boot script.
        case "$1" in
            console)
                if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
                  BOOTFILE="$REL_DIR/$REL_NAME"
                else
                  BOOTFILE="$REL_DIR/start"
                fi
                ;;
            console_clean)
                BOOTFILE="$ROOTDIR/bin/start_clean"
                __code_paths=$(_get_code_paths)
                EXTRA_CODE_PATHS=${__code_paths}
                ;;
            console_boot)
                shift
                BOOTFILE="$1"
                shift
                ;;
        esac
        # Setup beam-required vars
        EMU="beam"
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        _check_cookie

        # Start the VM, executing pre_start hook along
        # the way. We can't run the post_start hook because
        # the console will crash with no TTY attached
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" \
            -boot "$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${EXTRA_CODE_PATHS} \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -user Elixir.IEx.CLI \
            -extra --no-halt +iex

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS} ${EXTRA_OPTS}
            echo "Root: $ROOTDIR"

            # Log the startup
            echo "$RELEASE_ROOT_DIR"
        fi;

        logger -t "$REL_NAME[$$]" "Starting up"

        exec "$@" -- ${1+$ARGS} ${EXTRA_OPTS}
        ;;

    foreground)
        # start up the release in the foreground for use by runit
        # or other supervision services

        [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
        FOREGROUNDOPTIONS="-noshell -noinput +Bd"

        # Setup beam-required vars
        EMU=beam
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        _check_cookie

        # Start the VM, executing pre and post start hooks
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
            -boot "$REL_DIR/$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -extra ${EXTRA_OPTS}

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS}
            echo "Root: $ROOTDIR"
        fi;

        "$@" -- ${1+$ARGS} &
        __bg_pid=$!
        _run_hooks_from_dir "$POST_START_HOOKS"
        wait $__bg_pid
        ;;
    rpc)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpc $@
        ;;
    rpcterms)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpcterms $@
        ;;
    eval)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        nodetool "eval" $@
        ;;
    command)
        # Execute as command-line utility
        #
        # Like the escript command, this does not start the OTP application.
        # If your command depends on a running OTP application,
        # use
        #
        #     {:ok, _} = Application.ensure_all_started(:your_app)

        _check_cookie

        shift
        MODULE="$1"; shift
        FUNCTION="$1"; shift

        # Save extra arguments
        ARGS="$@"

        # Build arguments for erlexec
        __code_paths=$(_get_code_paths)
        set -- "$ERL_OPTS"
        [ "$SYS_CONFIG_PATH" ] && set -- "$@" -config "$SYS_CONFIG_PATH"
        set -- "$@" -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR"
        set -- "$@" -noshell
        set -- "$@" -boot start_clean
        set -- "$@" -pa "$CONSOLIDATED_DIR"
        set -- "$@" ${__code_paths}
        set -- "$@" -s "$MODULE" "$FUNCTION"

        $BINDIR/erlexec $@ -extra $ARGS
        exit "$?"
        ;;
    *)
        __command_path="$REL_DIR/commands/$1"
        if [ -f "$__command_path" ]; then
            _check_cookie
            . "$__command_path"
        else
            echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|escript|rpc|rpcterms|eval|command <module> <function> <args>}"
            exit 1
        fi
        ;;
esac

exit 0

#!/bin/sh

set -e

# Set VERBOSE to enable verbose logging of the boot script
#VERBOSE=true
if [ ! -z $DEBUG_BOOT ]; then
    set -x
fi;

my_readlink_f() {
    TARGET_FILE="$1"
    cd $(dirname "$TARGET_FILE")
    TARGET_FILE=$(basename "$TARGET_FILE")

    # Iterate down a (possible) chain of symlinks
    while [ -L "$TARGET_FILE" ]
    do
        TARGET_FILE=$(readlink "$TARGET_FILE")
        cd $(dirname "$TARGET_FILE")
        TARGET_FILE=$(basename "$TARGET_FILE")
    done
    # Compute the canonicalized name by finding the physical path
    # for the directory we're in and appending the target file.
    PHYS_DIR=$(pwd -P)
    RESULT="$PHYS_DIR/$TARGET_FILE"
    echo "$RESULT"
}

# Path to this script
if uname | grep -q 'Darwin'; then
  # on OSX, best to install coreutils from homebrew or similar
  # to get greadlink
  if command -v greadlink >/dev/null 2>&1; then
    SCRIPT=$(greadlink -f "$0")
  else
    SCRIPT=$(my_readlink_f "$0" )
  fi
else
  SCRIPT=$(readlink -f "$0" )
fi

# Parent directory of this script
SCRIPT_DIR=$(dirname "${SCRIPT}")
# Root directory of all releases
RELEASE_ROOT_DIR=$(dirname $(dirname ${SCRIPT_DIR}))

# Disable flow control for run_erl
# Flow control can cause several problems. On Linux, if you
# accidentally hit Ctrl-S (instead of Ctrl-D to detach) and
# then some other key, the entire beam process will hang when
# attempting to write to stdout. On Solaris, the beam process
# will hang on writing if ScrollLock is on.
RUN_ERL_DISABLE_FLOWCNTRL="${RUN_ERL_DISABLE_FLOWCNTRL:-true}"
# Name of the release
REL_NAME="<%= release_name %>"
# Current version of the release
REL_VSN="<%= release_version %>"
# Current version of ERTS being used
# If this is not present/unset, it will be detected
<%= if (include_erts and not is_nil(erts_vsn)) do %>ERTS_VSN="<%= erts_vsn %>"<% end %>
# VM code loading mode, embedded by default, can also be interactive
# See http://erlang.org/doc/man/code.html
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
# Path to start_erl.data
START_ERL_DATA="$RELEASE_ROOT_DIR/releases/start_erl.data"
# Directory containing the current version of this release
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
# The lib directory for this release
REL_LIB_DIR="$RELEASE_ROOT_DIR/lib"
# Options passed to erl
ERL_OPTS="<%= release.profile.erl_opts %>"
# When stdout is piped to a file, this is the directory those files will
# be stored in. defaults to /log in the release root directory

# RELEASE_MUTABLE_DIR
RELEASE_MUTABLE_DIR="${RELEASE_MUTABLE_DIR:-$RELEASE_ROOT_DIR/var}"

RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_MUTABLE_DIR/log}"
# A string of extra options to pass to erl, here for plugins
EXTRA_OPTS=""

# Pre-start/stop event hook paths
PRE_START_HOOKS="$REL_DIR/hooks/pre_start.d"
POST_START_HOOKS="$REL_DIR/hooks/post_start.d"
PRE_STOP_HOOKS="$REL_DIR/hooks/pre_stop.d"
POST_STOP_HOOKS="$REL_DIR/hooks/post_stop.d"
PRE_UPGRADE_HOOKS="$REL_DIR/hooks/pre_upgrade.d"
POST_UPGRADE_HOOKS="$REL_DIR/hooks/post_upgrade.d"

# Get node pid
get_pid() {
    if output="$(nodetool rpcterms os getpid)"
    then
        echo "$output" | sed -e 's/"//g'
        return 0
    else
        echo "$output"
        return 1
    fi
}

# Generate a unique nodename
gen_nodename() {
    id="longname$(gen_id)-${NAME}"
    "$BINDIR/erl" -boot start_clean -eval '[Host] = tl(string:tokens(atom_to_list(node()),"@")), io:format("~s~n", [Host]), halt()' -noshell ${NAME_TYPE} $id
}

# Generate a random id
gen_id() {
    od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
}

# Control a node
# Use like `nodetool "ping"`
nodetool() {
    command="$1"; shift

    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
                            -setcookie "$COOKIE" "$command" $@
}

# Run an escript in the node's environment
# Use like `escript "path/to/escript"`
escript() {
    shift; scriptpath="$1"; shift
    export RELEASE_ROOT_DIR

    "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}

# Private. Load target cookie, either from vm.args or $HOME/.cookie
_load_cookie() {
    COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
    DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
    if [ -z "$COOKIE_ARG" ]; then
        if [ -f "$DEFAULT_COOKIE_FILE" ]; then
            COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
        fi
    else
        # Extract cookie name from COOKIE_ARG
        COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
    fi
}

# Private. Ensure that cookie is set.
_check_cookie() {
    # Attempt reloading cookie in case it has been set in a hook
    if [ -z "$COOKIE" ]; then
        _load_cookie
    fi
    # Die if cookie is still not set, as connecting via distribution will fail
    if [ -z "$COOKIE" ]; then
        printf "a secret cookie must be provided in one of the following ways:\n  - with vm.args using the -setcookie parameter,\n  or\n  by writing the cookie to '$DEFAULT_COOKIE_FILE', with permissions set to 0400"
        exit 1
    fi
}

# Private. For determining the version of ERTS available to the release
# This is only ever called if ERTS_VSN is not set
_detect_erts_vsn() {
    set +e # temporarily disable so we can display a nice error message to the user
    __erl="$(which erl)"
    set -e
    if [ -z "${__erl}"  ]; then
        echo 'erlang runtime not found. If erlang is installed check your $PATH. aborting.'
        exit 1
    fi
    "$__erl" -boot start_clean -eval 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' -noshell
}

# Private. Gets a list of code paths for this release
_get_code_paths() {
    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/release_utils.escript" "get_code_paths" "$ROOTDIR" "$ERTS_DIR" "$REL_NAME" "$REL_VSN"
}

# Private. For setting ERTS_DIR and ROOTDIR
_find_erts_dir() {
    __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN"
    if [ -d "$__erts_dir" ]; then
        ERTS_DIR="$__erts_dir";
        ROOTDIR="$RELEASE_ROOT_DIR"
    else
        set +e # temporarily disable so we can display a nice error message to the user
        __erl="$(which erl)"
        set -e
        if [ -z "${__erl}"  ]; then
          echo 'erlang runtime not found. If erlang is installed check your $PATH. aborting.'
          exit 1
        fi
        code="io:format(\"~s\", [code:root_dir()]), halt()."
        __erl_root="$("$__erl" -noshell -eval "$code")"
        ERTS_DIR="$__erl_root/erts-$ERTS_VSN"
        ROOTDIR="$__erl_root"
    fi
}

# Private. Open a shell on a remote node
_rem_sh() {
    # Generate a unique id used to allow multiple remsh to the same node
    # transparently
    id="remsh$(gen_id)-${NAME}"

    # Get the node's ticktime so that we use the same thing.
    TICKTIME="$(nodetool rpcterms net_kernel get_net_ticktime)"

    # Setup remote shell command to control node
    if [ ! -z "$USE_ERL_SHELL" ]; then
        exec "$BINDIR/erl" \
            -hidden \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            "$NAME_TYPE" "$id" -remsh "$NAME" -setcookie "$COOKIE"
    else
        __code_paths=$(_get_code_paths)
        exec "$BINDIR/erl" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -hidden -noshell \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            -user Elixir.IEx.CLI "$NAME_TYPE" "$id" -setcookie "$COOKIE" \
            -extra --no-halt +iex -"$NAME_TYPE" "$id" --cookie "$COOKIE" --remsh "$NAME"
    fi
}

# Output a start command for the last argument of run_erl
_start_command() {
    printf "exec \"%s\" \"%s\" -- %s %s" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \
           "$START_OPTION" "${ARGS}" "${EXTRA_OPTS}"
}

# Do a textual replacement of ${VAR} occurances in $1 and pipe to $2
_replace_os_vars() {
    awk '
        function escape(s) {
            gsub(/'\&'/, "\\\\&", s);
            return s;
        }
        {
            while(match($0,"[$]{[^}]*}")) {
                var=substr($0,RSTART+2,RLENGTH-3);
                gsub("[$]{"var"}", escape(ENVIRON[var]))
            }
        }1' < "$1" > "$1.bak"
    mv -- "$1.bak" "$1"
}

# Private. Run hooks from directory.
_run_hooks_from_dir() {
   if [ -d "$1" ]; then
      for file in $1/[0-9a-zA-Z]*.sh; do
        [ -f "$file" ] || continue
        . "$file"
      done
   fi
}

# If TERM is not set, set it to xterm
if [ -z "$TERM" ]; then
    export TERM=xterm
fi

# If ERTS_VSN is not set, detect it
if [ -z "$ERTS_VSN" ]; then
    ERTS_VSN="$(_detect_erts_vsn)"
    echo "$ERTS_VSN $REL_VSN" > "$START_ERL_DATA"
fi

# Allow override of where to read configuration from
# By default it's RELEASE_ROOT_DIR
if [ -z "$RELEASE_CONFIG_DIR" ]; then
    RELEASE_CONFIG_DIR="$RELEASE_ROOT_DIR"
fi

# Make sure directories exist
mkdir -p "$RELEASE_MUTABLE_DIR"
echo "Files in this directory are regenerated frequently, edits will be lost" \
    > "$RELEASE_MUTABLE_DIR/WARNING_README"
mkdir -p "$RUNNER_LOG_DIR"

# Set VMARGS_PATH, the path to the vm.args file to use
# Use $RELEASE_CONFIG_DIR/vm.args if exists, otherwise releases/VSN/vm.args
if [ -z "$VMARGS_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/vm.args" ]; then
        VMARGS_PATH="$RELEASE_CONFIG_DIR/vm.args"
    else
        VMARGS_PATH="$REL_DIR/vm.args"
    fi
fi
if [ "$VMARGS_PATH" != "$RELEASE_MUTABLE_DIR/vm.args" ]; then
    echo "#### Generated - edit/create $RELEASE_CONFIG_DIR/vm.args instead." \
        >  "$RELEASE_MUTABLE_DIR/vm.args"
    cat  "$VMARGS_PATH"                              \
        >> "$RELEASE_MUTABLE_DIR/vm.args"
    VMARGS_PATH=$RELEASE_MUTABLE_DIR/vm.args
fi
if [ $REPLACE_OS_VARS ]; then
    _replace_os_vars "$VMARGS_PATH"
fi

# Set SYS_CONFIG_PATH, the path to the sys.config file to use
# Use $RELEASE_CONFIG_DIR/sys.config if exists, otherwise releases/VSN/sys.config
if [ -z "$SYS_CONFIG_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/sys.config" ]; then
        SYS_CONFIG_PATH="$RELEASE_CONFIG_DIR/sys.config"
    else
        SYS_CONFIG_PATH="$REL_DIR/sys.config"
    fi
fi
if [ "$SYS_CONFIG_PATH" != "$RELEASE_MUTABLE_DIR/sys.config" ]; then
    echo "%% Generated - edit/create $RELEASE_CONFIG_DIR/sys.config instead." \
        >  "$RELEASE_MUTABLE_DIR/sys.config"
    cat  "$SYS_CONFIG_PATH"                              \
        >> "$RELEASE_MUTABLE_DIR/sys.config"
    SYS_CONFIG_PATH=$RELEASE_MUTABLE_DIR/sys.config
fi
if [ $REPLACE_OS_VARS ]; then
    _replace_os_vars "$SYS_CONFIG_PATH"
fi

# Extract the target node name from node.args
# Should be `-sname somename` or `-name somename@somehost`
NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH" || true)
if [ -z "$NAME_ARG" ]; then
    echo "vm.args needs to have either -name or -sname parameter."
    exit 1
fi

# Extract the name type and name from the NAME_ARG for REMSH
# NAME_TYPE should be -name or -sname
NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')"
# NAME will be either `somename` or `somename@somehost`
NAME="$(echo "$NAME_ARG" | awk '{print $2}')"

# Where the pipe will be stored when using `start`
# This is used so you can attach the running application to the current
# shell using `attach`
PIPE_DIR="${PIPE_DIR:-$RELEASE_MUTABLE_DIR/erl_pipes/$NAME/}"

# Extract the target cookie
_load_cookie

_find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"
export EMU="beam"
export PROGNAME="erl"
export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
ERTS_LIB_DIR="$ERTS_DIR/../lib"
CONSOLIDATED_DIR="$ROOTDIR/lib/${REL_NAME}-${REL_VSN}/consolidated"

cd "$ROOTDIR"

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
    *@*)
        # Nothing to do
        ;;
    *)
        NAME=$NAME@$(gen_nodename)
        ;;
esac

# Check the first argument for instructions
case "$1" in
    start|start_boot)

        # Make sure there is not already a node running
        #RES=`$NODETOOL ping`
        #if [ "$RES" = "pong" ]; then
        #    echo "Node is already running!"
        #    exit 1
        #fi
        # Save this for later.
        CMD=$1
        case "$1" in
            start)
                shift
                START_OPTION="console"
                HEART_OPTION="start"
                ;;
            start_boot)
                shift
                START_OPTION="console_boot"
                HEART_OPTION="start_boot"
                ;;
        esac
        ARGS="$@"
        RUN_PARAM="$@"

        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Set arguments for the heart command
        set -- "$SCRIPT_DIR/$REL_NAME" "$HEART_OPTION"
        [ "$RUN_PARAM" ] && set -- "$@" "$RUN_PARAM"

        # Export the HEART_COMMAND
        HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $CMD"
        export HEART_COMMAND

        mkdir -p "$PIPE_DIR"

        "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
                          "$(_start_command)"

        _run_hooks_from_dir "$POST_START_HOOKS"
        ;;

    stop)
        _check_cookie
        _run_hooks_from_dir "$PRE_STOP_HOOKS"
        # Wait for the node to completely stop...
        PID="$(get_pid)"
        if ! nodetool "stop"; then
            exit 1
        fi
        while $(kill -s 0 "$PID" 2>/dev/null);
        do
            sleep 1
        done
        _run_hooks_from_dir "$POST_STOP_HOOKS"
        ;;

    restart)
        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"
        ## Restart the VM without exiting the process
        if ! nodetool "restart"; then
            exit 1
        fi
        ;;

    reboot)
        _check_cookie
        _run_hooks_from_dir "$PRE_START_HOOKS"
        ## Restart the VM completely (uses heart to restart it)
        if ! nodetool "reboot"; then
            exit 1
        fi
        ;;

    pid)
        ## Get the VM's pid
        _check_cookie
        if ! get_pid; then
            exit 1
        fi
        ;;

    ping)
        _check_cookie
        ## See if the VM is alive
        if ! nodetool "ping"; then
            exit 1
        fi
        ;;

    escript)
        _check_cookie
        ## Run an escript under the node's environment
        if ! escript $@; then
            exit 1
        fi
        ;;

    attach)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        exec "$BINDIR/to_erl" "$PIPE_DIR"
        ;;

    remote_console)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        _rem_sh
        ;;

    upgrade|downgrade|install)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        SOURCE_VERSION="$REL_VSN"
        TARGET_VERSION="$2"

        "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "unpack_release" "$REL_NAME" "$NAME_TYPE"  "$NAME" "$COOKIE" "$TARGET_VERSION"

        _run_hooks_from_dir "$PRE_UPGRADE_HOOKS"

        "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "install_release" "$REL_NAME" "$NAME_TYPE"  "$NAME" "$COOKIE" "$TARGET_VERSION"

        _run_hooks_from_dir "$POST_UPGRADE_HOOKS"

        ;;
    unpack)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/release_utils.escript" \
             "unpack_release" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    console|console_clean|console_boot)
        # .boot file typically just $REL_NAME (ie, the app name)
        # however, for debugging, sometimes start_clean.boot is useful.
        # For e.g. 'setup', one may even want to name another boot script.
        case "$1" in
            console)
                if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
                  BOOTFILE="$REL_DIR/$REL_NAME"
                else
                  BOOTFILE="$REL_DIR/start"
                fi
                ;;
            console_clean)
                BOOTFILE="$ROOTDIR/bin/start_clean"
                __code_paths=$(_get_code_paths)
                EXTRA_CODE_PATHS=${__code_paths}
                ;;
            console_boot)
                shift
                BOOTFILE="$1"
                shift
                ;;
        esac
        # Setup beam-required vars
        EMU="beam"
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        _check_cookie

        # Start the VM, executing pre_start hook along
        # the way. We can't run the post_start hook because
        # the console will crash with no TTY attached
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" \
            -boot "$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${EXTRA_CODE_PATHS} \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -user Elixir.IEx.CLI \
            -extra --no-halt +iex

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS} ${EXTRA_OPTS}
            echo "Root: $ROOTDIR"

            # Log the startup
            echo "$RELEASE_ROOT_DIR"
        fi;

        logger -t "$REL_NAME[$$]" "Starting up"

        exec "$@" -- ${1+$ARGS} ${EXTRA_OPTS}
        ;;

    foreground)
        # start up the release in the foreground for use by runit
        # or other supervision services

        [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
        FOREGROUNDOPTIONS="-noshell -noinput +Bd"

        # Setup beam-required vars
        EMU=beam
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        _check_cookie

        # Start the VM, executing pre and post start hooks
        _run_hooks_from_dir "$PRE_START_HOOKS"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
            -boot "$REL_DIR/$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -extra ${EXTRA_OPTS}

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS}
            echo "Root: $ROOTDIR"
        fi;

        "$@" -- ${1+$ARGS} &
        __bg_pid=$!
        _run_hooks_from_dir "$POST_START_HOOKS"
        wait $__bg_pid
        ;;
    rpc)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpc $@
        ;;
    rpcterms)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpcterms $@
        ;;
    eval)
        _check_cookie

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        nodetool "eval" $@
        ;;
    command)
        # Execute as command-line utility
        #
        # Like the escript command, this does not start the OTP application.
        # If your command depends on a running OTP application,
        # use
        #
        #     {:ok, _} = Application.ensure_all_started(:your_app)

        _check_cookie

        shift
        MODULE="$1"; shift
        FUNCTION="$1"; shift

        # Save extra arguments
        ARGS="$@"

        # Build arguments for erlexec
        __code_paths=$(_get_code_paths)
        set -- "$ERL_OPTS"
        [ "$SYS_CONFIG_PATH" ] && set -- "$@" -config "$SYS_CONFIG_PATH"
        set -- "$@" -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR"
        set -- "$@" -noshell
        set -- "$@" -boot start_clean
        set -- "$@" -pa "$CONSOLIDATED_DIR"
        set -- "$@" ${__code_paths}
        set -- "$@" -s "$MODULE" "$FUNCTION"

        $BINDIR/erlexec $@ -extra $ARGS
        exit "$?"
        ;;
    *)
        __command_path="$REL_DIR/commands/$1"
        if [ -f "$__command_path" ]; then
            _check_cookie
            . "$__command_path"
        else
            echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|escript|rpc|rpcterms|eval|command <module> <function> <args>}"
            exit 1
        fi
        ;;
esac

exit 0


fixed comments error

fixed comments error

<input type="hidden" id="post-id" value="<%= @post.id %>">

				<a class="carousel-item" href="<%= Flour.Photo.url(hd(@post.photos),:original)%>" data-gallery>
				  <img class="responsive-img" src="<%= Flour.Photo.url(hd(@post.photos), :thumb) %>"/>

			  我❤久久

				 <%= for photo <- tl(@post.photos) do %>

					<a class="carousel-item" href="<%= Flour.Photo.url(photo,:original)%>" data-gallery>
						<img class="responsive-img" src="<%= Flour.Photo.url(photo, :thumb) %>"/>

				 <% end %>

					<%= @flower_count %>

            <img class="responsive-img circle red" src="<%= @post.user.headimgurl %>"/>

              对（他／她）说：
              <%= @post.content %>

天上鹊桥，人间七巧，今宵月圆花好，有情人欢喜相邀。黄昏后，柳梢头，窃窃私语，幸福成双，不似牛郎织女，赛过神仙眷属！

filter_drama甜蜜派

						  <%= link "发布我的幸福", to: post_path(@conn, :new), class: "waves-effect waves-light btn-large pink lighten-2" %>

place行动派

        立即下单

          给她送上鲜花

<%= form_for @changeset, post_path(@conn, :comment, @post.id), [multipart: true, id: "comments-form"],  fn f -> %>

    <%= textarea f, :content, placeholder: "祝福语：", class: "materialize-textarea validate",  required: "true"  %>
    <%= error_tag f, :content %>

      <%= submit "送上祝福", class: "btn waves-light pink lighten-3" %>

<% end %>

   <%= for comment <- @post.comments do %>

      <img class="circle" src="<%= comment.user.headimgurl %>"/>

<%= comment.content %>

        <%= comment.user.nickname %>

      grade

   <% end %>

<input type="hidden" id="post-id" value="<%= @post.id %>">

				<a class="carousel-item" href="<%= Flour.Photo.url(hd(@post.photos),:original)%>" data-gallery>
				  <img class="responsive-img" src="<%= Flour.Photo.url(hd(@post.photos), :thumb) %>"/>

			  我❤久久

				 <%= for photo <- tl(@post.photos) do %>

					<a class="carousel-item" href="<%= Flour.Photo.url(photo,:original)%>" data-gallery>
						<img class="responsive-img" src="<%= Flour.Photo.url(photo, :thumb) %>"/>

				 <% end %>

					<%= @flower_count %>

            <img class="responsive-img circle red" src="<%= @post.user.headimgurl %>"/>

              对（他／她）说：
              <%= @post.content %>

天上鹊桥，人间七巧，今宵月圆花好，有情人欢喜相邀。黄昏后，柳梢头，窃窃私语，幸福成双，不似牛郎织女，赛过神仙眷属！

filter_drama甜蜜派

						  <%= link "发布我的幸福", to: post_path(@conn, :new), class: "waves-effect waves-light btn-large pink lighten-2" %>

place行动派

        立即下单

          给她送上鲜花

<%= form_for @changeset, post_path(@conn, :comment, @post.id), [multipart: true, id: "comments-form"],  fn f -> %>

    <%= textarea f, :content, placeholder: "祝福语：", class: "materialize-textarea validate",  required: "true"  %>
    <%= error_tag f, :content %>

      <%= submit "送上祝福", class: "btn waves-light pink lighten-3" %>

<% end %>

   <%= for comment <- tl(@post.comments) do %>

      <img class="circle" src="<%= comment.user.headimgurl %>"/>

<%= comment.content %>

        <%= comment.user.nickname %>

      grade

   <% end %>


Remove not needed view

Remove not needed view

  <%= form_for @conn, offer_path(@conn, :index), [as: :filter, method: :get], fn f -> %>

      <%= text_input(f, :text,
        id: "filter_text",
        class: class_with_error(f, :text, "text"),
        placeholder: gettext("Search offers by title, location...")) %>

      <%= select(f, :job_place, get_job_place_options(gettext("Unknown")), prompt: gettext("Any job place")) %>

    <%= select(f, :job_type, get_job_type_options(gettext("Unknown")), prompt: gettext("Any job type")) %>

    <%= submit(gettext("Search"), class: "btn-success") %>
  <% end %>


Update not found page

Update not found page

HTTP/1.1 404 Not Found

    You tried to find something that doesn’t exist. Maybe it did at some point, but it sure doesn’t anymore.

    <a href="<%= home_url %>">Go away.


Disable css animations in test

Disable css animations in test

  - results in less-flaky builds, as the javascript driver doesn't attempt to click elements that may be hidden
  - also results in faster builds

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="A real-time application for conducting Agile retrospectives">
    <meta name="google-site-verification" content="T5W8sjrjt-BmTK5SYTjPM-FQZD8oGNatTNAJSyRex7o" />
    <meta name="author" content="">
    <title>RemoteRetro</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/semantic-ui/semantic.min.css") %>">
    <%= if Mix.env == :dev do %>
      <link id="css" rel="stylesheet" href="http://localhost:5001/css/app.css" />
    <% else %>
      <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
    <% end %>

    <%= if Mix.env == :test do %>

    <% end %>

  <body class="<%= if assigns[:is_landing_page], do: "landing-page" %>">

    <%= unless assigns[:omit_header] do %>

RemoteRetro

Built by

    <% end %>
      <%= render @view_module, @view_template, assigns %>

    <%= if assigns[:include_js] do %>

    <% end %>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="A real-time application for conducting Agile retrospectives">
    <meta name="google-site-verification" content="T5W8sjrjt-BmTK5SYTjPM-FQZD8oGNatTNAJSyRex7o" />
    <meta name="author" content="">
    <title>RemoteRetro</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/semantic-ui/semantic.min.css") %>">
    <%= if Mix.env == :dev do %>
      <link id="css" rel="stylesheet" href="http://localhost:5001/css/app.css" />
    <% else %>
      <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
    <% end %>

  <body class="<%= if assigns[:is_landing_page], do: "landing-page" %>">

    <%= unless assigns[:omit_header] do %>

RemoteRetro

Built by

    <% end %>
      <%= render @view_module, @view_template, assigns %>

    <%= if assigns[:include_js] do %>

    <% end %>


two generators ...

two generators ...

Top 5 liked Podcasts

  <% last_count = 0 %>
    <%= for {[count, id, title], rank} <- Enum.with_index(@liked_podcasts), last_count <- last_count do %>

        <%= if count != last_count do %>
          <%= rank + 1 %>.:
        <% else %>

        <% end %>
        <%= link [fa_icon("podcast"), " ", truncate(title, 50)],
                 to: podcast_frontend_path(@conn, :show, id),
                 class: "btn btn-default btn-xs",
                 style: "color: #000" %>
        <%= count %> <%= fa_icon("user") %>
        <% last_count = count %>

    <% end %>

Top 5 liked Podcasts

  <% last_count = 0 %>
    <%= for {[count, id, title], rank} <- Enum.with_index(@liked_podcasts) do %>

        <%= if count != last_count do %>
          <%= rank + 1 %>.:
        <% else %>

        <% end %>
        <%= link [fa_icon("podcast"), " ", truncate(title, 50)],
                 to: podcast_frontend_path(@conn, :show, id),
                 class: "btn btn-default btn-xs",
                 style: "color: #000" %>
        <%= count %> <%= fa_icon("user") %>
        <% last_count = count %>

    <% end %>


Whops dont even need this...

Whops dont even need this...

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" type="image/png" href="/favicon.png" />
    <title>Slack Coder</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

            Slack Coder

Monitoring your pull requests

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

      <%= @inner %>

    <scritp src="https://code.jquery.com/jquery-2.1.4.min.js"></script>


Updated homepage, styles

Updated homepage, styles

Cast your vote now!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

    Start voting

Leading Presidentiables

Leading Vice-Presidentiables

Leading Senators

Cast your vote now!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

We are in an information age where we should no longer be poisoned by the media!

    Start voting

Leading Presidentiables

Leading Presidentiables

Leading Presidentiables


fix template in progress

fix template in progress

mobile:<%= mobile? @conn %>
desctop:<%= desctop? @conn %>

        <form style='<%= if mobile? @conn do %> "padding: 5px 15px; margin-top: -9px; margin-bottom: 0;" <% end %>'
              class="navbar-form" role="search" action="<%= entry_path(@conn, :index) %>">

          <%#= take_params_hidden_field_tags :list, :divas %>

          <div class='input-group <%= if mobile? @conn do %> "input-group-sm" <% end %>'>
            <%= gettext "Let fill out search word for XXX videos" %>
            <input class="form-control" type="search" name="search"
            value='<%= @conn.params["search"] %><%= @conn.params["tag"] %>' placeholder="<%= gettext "Search XXX Videos" %>" autocomplete='on' />

              <button class="btn btn-default" type="submit"></button>

        </form>

          <%= if @conn.params["search"] do %>
            <%= gettext "Relevant Video Results: %{name}", name: @conn.params["search"] %>
          <% else %>
            <%= gettext "Recently XXX Videos" %>
          <% end %>

          <%#
          ten_minutes_path = take_params(:list, :page, :search, :site_name, :tag, :divas)
          if params[:t600].blank?, do: ten_minutes_path = ten_minutes_path.merge(t600: 1)
          %>
          <%
          ten_minutes_path = @conn.query_params
          %>
          <a href="<%= entry_path(@conn, :index, ten_minutes_path) %>"
              type="button"
              class="btn btn-default <%= if mobile? @conn do %>btn-sm<% end %> <%= if @conn.params["t600"] do %>active<% end %>">
            <%= gettext "Over 10 Min" %>

          <%= if desctop? @conn do %>

            <a href="<%#= entries_path take_params(:t600, :page, :search, :site_name, :tag, :divas) %>"
                type="button"
                class="btn btn-default <%= unless @conn.params["list"] do %>active<% end %>">

            <a href="<%#= entries_path take_params(:t600, :page, :search, :site_name, :tag, :divas).merge(list: 1) %>"
                type="button"
                class="btn btn-default <%= if @conn.params[:list] do %>active<% end %>">

          <% end %>

          <%= if @conn.params["search"] do %>
            <%= @conn.params["search"] %>
            <%= gettext "Search - %{num} results", num: number_with_delimiter(@entries.total_entries) %>
          <% else %>
            <%= number_with_delimiter(@entries.total_entries) %> <%= gettext "Showing" %>
          <% end %>

        <%= render "_entries.html", conn: @conn, entries: @entries %>

            <%= pagination_links @entries %>

            <%#= paginate @entries %>
            <%#= link_to_next_page @entries,
                  t('views.pagination.next'),
                  remote: true,
                  params: params do
            %>
              <%# ページがありません %>
            <%# end %>

             <%= gettext "Relevant tag" %>

            <%= for term <- @entries.tirexs[:facets][:tags][:terms] do %>

                <a href="<%#= entries_path take_params(:list).merge(search: term['term'])  %>"
                   title="<%= gettext "Jump to %{tag}'s video results", tag: term[:term] %>"
                   rel="category tag nofollow"
                >
                  <h2 style='<%#= if tags_exists term["term"] %>color: #d9534f; font-weight: bold;' <%# end  %>
                      class="no-heading-style"><%= term[:term] %>(<%= term[:count] %>)

            <% end %>

mobile:<%= mobile? @conn %>
desctop:<%= desctop? @conn %>

        <form style='<%= if mobile? @conn do %> "padding: 5px 15px; margin-top: -9px; margin-bottom: 0;" <% end %>'
              class="navbar-form" role="search" action="<%#= entries_path %>">

          <%#= take_params_hidden_field_tags :list, :divas %>

          <div class='input-group <%= if mobile? @conn do %> "input-group-sm" <% end %>'>
            <%= gettext "Let fill out search word for XXX videos" %>
            <input class="form-control" type="search" name="search"
            value='<%= @conn.params["search"] %><%= @conn.params["tag"] %>' placeholder="<%= gettext "Search XXX Videos" %>" autocomplete='on' />

              <button class="btn btn-default" type="submit"></button>

        </form>

          <%= if @conn.params["search"] do %>
            <%= gettext "Relevant Video Results: %{name}", name: @conn.params["search"] %>
          <% else %>
            <%= gettext "Recently XXX Videos" %>
          <% end %>

          <%#
          ten_minutes_path = take_params(:list, :page, :search, :site_name, :tag, :divas)
          if params[:t600].blank?, do: ten_minutes_path = ten_minutes_path.merge(t600: 1)
          %>
          <a href="<%#= entries_path ten_minutes_path %>"
              type="button"
              class="btn btn-default <%= if mobile? @conn do %>btn-sm<% end %> <%= if @conn.params["t600"] do %>active<% end %>">
            <%= gettext "Over 10 Min" %>

          <%= if desctop? @conn do %>

            <a href="<%#= entries_path take_params(:t600, :page, :search, :site_name, :tag, :divas) %>"
                type="button"
                class="btn btn-default <%= unless @conn.params["list"] do %>active<% end %>">

            <a href="<%#= entries_path take_params(:t600, :page, :search, :site_name, :tag, :divas).merge(list: 1) %>"
                type="button"
                class="btn btn-default <%= if @conn.params[:list] do %>active<% end %>">

          <% end %>

          <%= if @conn.params["search"] do %>
            <%= @conn.params["search"] %>
            <%= gettext "Search - %{num} results", num: number_with_delimiter(@entries.total_entries) %>
          <% else %>
            <%= number_with_delimiter(@entries.total_entries) %> <%= gettext "Showing" %>
          <% end %>

        <%= render "_entries.html", conn: @conn, entries: @entries %>

            <%= pagination_links @entries %>

            <%#= paginate @entries %>
            <%#= link_to_next_page @entries,
                  t('views.pagination.next'),
                  remote: true,
                  params: params do
            %>
              <%# ページがありません %>
            <%# end %>

             <%= gettext "Relevant tag" %>

            <%= for term <- @entries.tirexs[:facets][:tags][:terms] do %>

                <a href="<%#= entries_path take_params(:list).merge(search: term['term'])  %>"
                   title="<%= gettext "Jump to %{tag}'s video results", tag: term[:term] %>"
                   rel="category tag nofollow"
                >
                  <h2 style='<%#= if tags_exists term["term"] %>color: #d9534f; font-weight: bold;' <%# end  %>
                      class="no-heading-style"><%= term[:term] %>(<%= term[:count] %>)

            <% end %>


Add contact us

Add contact us

            <%= raw gettext("ElixirJobs.net &copy %{year}", year: DateTime.utc_now.year) %>

          <%= link(gettext("Post a job offer"), to: offer_path(@conn, :new)) %>
          |
          <%= link(gettext("About this site"), to: page_path(@conn, :about)) %>

          Contact us

<%= link(gettext("Recent job postings"), to: offer_path(@conn, :index)) %>

          <%= link(gettext("On site jobs"), to: offer_path(@conn, :index_filtered, "onsite")) %>
          |
          <%= link(gettext("Remote jobs"), to: offer_path(@conn, :index_filtered, "remote")) %>

          <%= link(gettext("Full time jobs"), to: offer_path(@conn, :index_filtered, "full_time")) %>
          |
          <%= link(gettext("Part time jobs"), to: offer_path(@conn, :index_filtered, "part_time")) %>
          |
          <%= link(gettext("Freelance jobs"), to: offer_path(@conn, :index_filtered, "freelance")) %>

            <%= raw gettext("ElixirJobs.net &copy %{year}", year: DateTime.utc_now.year) %>

          <%= link(gettext("Post a job offer"), to: offer_path(@conn, :new)) %>
          |
          <%= link(gettext("About this site"), to: page_path(@conn, :about)) %>

<%= link(gettext("Recent job postings"), to: offer_path(@conn, :index)) %>

          <%= link(gettext("On site jobs"), to: offer_path(@conn, :index_filtered, "onsite")) %>
          |
          <%= link(gettext("Remote jobs"), to: offer_path(@conn, :index_filtered, "remote")) %>

          <%= link(gettext("Full time jobs"), to: offer_path(@conn, :index_filtered, "full_time")) %>
          |
          <%= link(gettext("Part time jobs"), to: offer_path(@conn, :index_filtered, "part_time")) %>
          |
          <%= link(gettext("Freelance jobs"), to: offer_path(@conn, :index_filtered, "freelance")) %>